There's a leak in the error case in bio_copy_user(). If we fail
allocating a page or adding a page to the bio, we will leak the bio map
data.
Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
bmd->userptr = (void __user *) uaddr;
+ ret = -ENOMEM;
bio = bio_alloc(GFP_KERNEL, end - start);
- if (!bio) {
- bio_free_map_data(bmd);
- return ERR_PTR(-ENOMEM);
- }
+ if (!bio)
+ goto out_bmd;
bio->bi_rw |= (!write_to_vm << BIO_RW);
__free_page(bvec->bv_page);
bio_put(bio);
+out_bmd:
+ bio_free_map_data(bmd);
return ERR_PTR(ret);
}