Commit 48785bb9 authored by Jens Axboe's avatar Jens Axboe

[PATCH] __blk_rq_unmap_user() fails to return error

If the bio is user copied, the copy back could return -EFAULT. Make
sure we return any error seen during unmapping.
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 9c9381f9
...@@ -2504,6 +2504,7 @@ EXPORT_SYMBOL(blk_rq_map_user_iov); ...@@ -2504,6 +2504,7 @@ EXPORT_SYMBOL(blk_rq_map_user_iov);
int blk_rq_unmap_user(struct request *rq) int blk_rq_unmap_user(struct request *rq)
{ {
struct bio *bio, *mapped_bio; struct bio *bio, *mapped_bio;
int ret = 0, ret2;
while ((bio = rq->bio)) { while ((bio = rq->bio)) {
if (bio_flagged(bio, BIO_BOUNCED)) if (bio_flagged(bio, BIO_BOUNCED))
...@@ -2511,11 +2512,15 @@ int blk_rq_unmap_user(struct request *rq) ...@@ -2511,11 +2512,15 @@ int blk_rq_unmap_user(struct request *rq)
else else
mapped_bio = bio; mapped_bio = bio;
__blk_rq_unmap_user(mapped_bio); ret2 = __blk_rq_unmap_user(mapped_bio);
if (ret2 && !ret)
ret = ret2;
rq->bio = bio->bi_next; rq->bio = bio->bi_next;
bio_put(bio); bio_put(bio);
} }
return 0;
return ret;
} }
EXPORT_SYMBOL(blk_rq_unmap_user); EXPORT_SYMBOL(blk_rq_unmap_user);
......
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