Skip to content

Commit

Permalink
[PATCH] __blk_rq_unmap_user() fails to return error
Browse files Browse the repository at this point in the history
If the bio is user copied, the copy back could return -EFAULT. Make
sure we return any error seen during unmapping.

Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Jens Axboe committed Dec 19, 2006
1 parent 9c9381f commit 48785bb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions block/ll_rw_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2504,18 +2504,23 @@ EXPORT_SYMBOL(blk_rq_map_user_iov);
int blk_rq_unmap_user(struct request *rq)
{
struct bio *bio, *mapped_bio;
int ret = 0, ret2;

while ((bio = rq->bio)) {
if (bio_flagged(bio, BIO_BOUNCED))
mapped_bio = bio->bi_private;
else
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;
bio_put(bio);
}
return 0;

return ret;
}

EXPORT_SYMBOL(blk_rq_unmap_user);
Expand Down

0 comments on commit 48785bb

Please sign in to comment.