Commit a60e78e57a17d55bbd5a96da16fe9649d364b987

Authored by Subhash Peddamallu
Committed by Jens Axboe
1 parent 93dbb39350

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>

Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff

... ... @@ -302,9 +302,10 @@
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;
... ... @@ -329,7 +330,7 @@
329 330 }
330 331 if (unlikely(!bvl)) {
331 332 if (bs)
332   - mempool_free(bio, bs->bio_pool);
  333 + mempool_free(p, bs->bio_pool);
333 334 else
334 335 kfree(bio);
335 336 bio = NULL;