diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2006-12-19 05:07:59 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2006-12-19 05:07:59 -0500 |
commit | 48785bb9fa39415d7553e234946442579dfcf591 (patch) | |
tree | 2f22a34dbc334daade0962a119b2b42795715df8 | |
parent | 9c9381f9425ab4d2f9f0458ae9525c18bc832f59 (diff) |
[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: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | block/ll_rw_blk.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c index 5d472e47c125..a66ec30855d8 100644 --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c | |||
@@ -2504,6 +2504,7 @@ EXPORT_SYMBOL(blk_rq_map_user_iov); | |||
2504 | int blk_rq_unmap_user(struct request *rq) | 2504 | int blk_rq_unmap_user(struct request *rq) |
2505 | { | 2505 | { |
2506 | struct bio *bio, *mapped_bio; | 2506 | struct bio *bio, *mapped_bio; |
2507 | int ret = 0, ret2; | ||
2507 | 2508 | ||
2508 | while ((bio = rq->bio)) { | 2509 | while ((bio = rq->bio)) { |
2509 | if (bio_flagged(bio, BIO_BOUNCED)) | 2510 | if (bio_flagged(bio, BIO_BOUNCED)) |
@@ -2511,11 +2512,15 @@ int blk_rq_unmap_user(struct request *rq) | |||
2511 | else | 2512 | else |
2512 | mapped_bio = bio; | 2513 | mapped_bio = bio; |
2513 | 2514 | ||
2514 | __blk_rq_unmap_user(mapped_bio); | 2515 | ret2 = __blk_rq_unmap_user(mapped_bio); |
2516 | if (ret2 && !ret) | ||
2517 | ret = ret2; | ||
2518 | |||
2515 | rq->bio = bio->bi_next; | 2519 | rq->bio = bio->bi_next; |
2516 | bio_put(bio); | 2520 | bio_put(bio); |
2517 | } | 2521 | } |
2518 | return 0; | 2522 | |
2523 | return ret; | ||
2519 | } | 2524 | } |
2520 | 2525 | ||
2521 | EXPORT_SYMBOL(blk_rq_unmap_user); | 2526 | EXPORT_SYMBOL(blk_rq_unmap_user); |