Skip to content

Commit

Permalink
fs/bio: bio_alloc_bioset: pass right object ptr to mempool_free
Browse files Browse the repository at this point in the history
When freeing from bio pool use right ptr to account for bs->front_pad,
instead of bio ptr,

Signed-off-by: Subhash Peddamallu <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
speddam authored and Jens Axboe committed Feb 18, 2009
1 parent 93dbb39 commit a60e78e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,10 @@ void bio_init(struct bio *bio)
struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
{
struct bio *bio = NULL;
void *p;

if (bs) {
void *p = mempool_alloc(bs->bio_pool, gfp_mask);
p = mempool_alloc(bs->bio_pool, gfp_mask);

if (p)
bio = p + bs->front_pad;
Expand All @@ -329,7 +330,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
}
if (unlikely(!bvl)) {
if (bs)
mempool_free(bio, bs->bio_pool);
mempool_free(p, bs->bio_pool);
else
kfree(bio);
bio = NULL;
Expand Down

0 comments on commit a60e78e

Please sign in to comment.