Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs/bio: bio_alloc_bioset: pass right object ptr to mempool_free

When freeing from bio pool use right ptr to account for bs->front_pad,
instead of bio ptr,

Signed-off-by: Subhash Peddamallu <subhash.peddamallu@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

authored by

Subhash Peddamallu and committed by
Jens Axboe
a60e78e5 93dbb393

+3 -2
+3 -2
fs/bio.c
··· 302 302 struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) 303 303 { 304 304 struct bio *bio = NULL; 305 + void *p; 305 306 306 307 if (bs) { 307 - void *p = mempool_alloc(bs->bio_pool, gfp_mask); 308 + p = mempool_alloc(bs->bio_pool, gfp_mask); 308 309 309 310 if (p) 310 311 bio = p + bs->front_pad; ··· 330 329 } 331 330 if (unlikely(!bvl)) { 332 331 if (bs) 333 - mempool_free(bio, bs->bio_pool); 332 + mempool_free(p, bs->bio_pool); 334 333 else 335 334 kfree(bio); 336 335 bio = NULL;