Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc5c8f07 authored by Gu Zheng's avatar Gu Zheng Committed by Linus Torvalds
Browse files

fs/bio-integrity: fix a potential mem leak



Free the bio_integrity_pool in the fail path of biovec_create_pool in
function bioset_integrity_create().

Signed-off-by: default avatarGu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a6b08887
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -716,13 +716,14 @@ int bioset_integrity_create(struct bio_set *bs, int pool_size)
		return 0;

	bs->bio_integrity_pool = mempool_create_slab_pool(pool_size, bip_slab);

	bs->bvec_integrity_pool = biovec_create_pool(bs, pool_size);
	if (!bs->bvec_integrity_pool)
	if (!bs->bio_integrity_pool)
		return -1;

	if (!bs->bio_integrity_pool)
	bs->bvec_integrity_pool = biovec_create_pool(bs, pool_size);
	if (!bs->bvec_integrity_pool) {
		mempool_destroy(bs->bio_integrity_pool);
		return -1;
	}

	return 0;
}