From: Jens Axboe Date: Tue, 19 Dec 2006 10:07:59 +0000 (+0100) Subject: [PATCH] __blk_rq_unmap_user() fails to return error X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=48785bb9fa39415d7553e234946442579dfcf591;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [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 --- 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); 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)) @@ -2511,11 +2512,15 @@ int blk_rq_unmap_user(struct request *rq) 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);