mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
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: Gu Zheng <guz.fnst@cn.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
a6b088875b
commit
bc5c8f0783
@ -716,14 +716,15 @@ 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)
|
||||
return -1;
|
||||
|
||||
if (!bs->bio_integrity_pool)
|
||||
return -1;
|
||||
|
||||
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;
|
||||
}
|
||||
EXPORT_SYMBOL(bioset_integrity_create);
|
||||
|
Loading…
Reference in New Issue
Block a user