mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-17 02:15:57 +00:00
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>
This commit is contained in:
parent
93dbb39350
commit
a60e78e57a
5
fs/bio.c
5
fs/bio.c
@ -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_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
|
||||||
{
|
{
|
||||||
struct bio *bio = NULL;
|
struct bio *bio = NULL;
|
||||||
|
void *p;
|
||||||
|
|
||||||
if (bs) {
|
if (bs) {
|
||||||
void *p = mempool_alloc(bs->bio_pool, gfp_mask);
|
p = mempool_alloc(bs->bio_pool, gfp_mask);
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
bio = p + bs->front_pad;
|
bio = p + bs->front_pad;
|
||||||
@ -329,7 +330,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
|
|||||||
}
|
}
|
||||||
if (unlikely(!bvl)) {
|
if (unlikely(!bvl)) {
|
||||||
if (bs)
|
if (bs)
|
||||||
mempool_free(bio, bs->bio_pool);
|
mempool_free(p, bs->bio_pool);
|
||||||
else
|
else
|
||||||
kfree(bio);
|
kfree(bio);
|
||||||
bio = NULL;
|
bio = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user