diff options
| author | Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn> | 2025-12-10 17:06:01 +0800 |
|---|---|---|
| committer | Carlos Maiolino <cem@kernel.org> | 2025-12-16 08:50:11 +0100 |
| commit | fc40459de82543b565ebc839dca8f7987f16f62e (patch) | |
| tree | 92806cb2162e528ebaf6c165da0d5c4c01ae666a | |
| parent | f06725052098d7b1133ac3846d693c383dc427a2 (diff) | |
xfs: fix a memory leak in xfs_buf_item_init()
xfs_buf_item_get_format() may allocate memory for bip->bli_formats,
free the memory in the error path.
Fixes: c3d5f0c2fb85 ("xfs: complain if anyone tries to create a too-large buffer log item")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
| -rw-r--r-- | fs/xfs/xfs_buf_item.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index 8d85b5eee444..f4c5be67826e 100644 --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c @@ -896,6 +896,7 @@ xfs_buf_item_init( map_size = DIV_ROUND_UP(chunks, NBWORD); if (map_size > XFS_BLF_DATAMAP_SIZE) { + xfs_buf_item_free_format(bip); kmem_cache_free(xfs_buf_item_cache, bip); xfs_err(mp, "buffer item dirty bitmap (%u uints) too small to reflect %u bytes!", |
