Commit fc40459d authored by Haoxiang Li's avatar Haoxiang Li Committed by Carlos Maiolino
Browse files

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: c3d5f0c2 ("xfs: complain if anyone tries to create a too-large buffer log item")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarHaoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarCarlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: default avatarCarlos Maiolino <cem@kernel.org>
parent f0672505
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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!",