Commit f449309b authored by Jérôme Glisse's avatar Jérôme Glisse Committed by Greg Kroah-Hartman

block: do not leak memory in bio_copy_user_iov()

commit a3761c3c91209b58b6f33bf69dd8bb8ec0c9d925 upstream.

When bio_add_pc_page() fails in bio_copy_user_iov() we should free
the page we just allocated otherwise we are leaking it.

Cc: Linus Torvalds <>
Reviewed-by: default avatarChaitanya Kulkarni <>
Signed-off-by: default avatarJérôme Glisse <>
Signed-off-by: default avatarJens Axboe <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent ad344fb8
......@@ -1216,8 +1216,11 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
if (bio_add_pc_page(q, bio, page, bytes, offset) < bytes)
if (bio_add_pc_page(q, bio, page, bytes, offset) < bytes) {
if (!map_data)
len -= bytes;
offset = 0;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment