From: Linus Torvalds Date: Wed, 7 Dec 2016 00:18:14 +0000 (-0800) Subject: Don't feed anything but regular iovec's to blk_rq_map_user_iov X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a0ac402cfcdc904f9772e1762b3fda112dcc56a0;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git Don't feed anything but regular iovec's to blk_rq_map_user_iov In theory we could map other things, but there's a reason that function is called "user_iov". Using anything else (like splice can do) just confuses it. Reported-and-tested-by: Johannes Thumshirn Cc: Al Viro Signed-off-by: Linus Torvalds --- diff --git a/block/blk-map.c b/block/blk-map.c index b8657fa8dc9a..27fd8d92892d 100644 --- a/block/blk-map.c +++ b/block/blk-map.c @@ -118,6 +118,9 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, struct iov_iter i; int ret; + if (!iter_is_iovec(iter)) + goto fail; + if (map_data) copy = true; else if (iov_iter_alignment(iter) & align) @@ -140,6 +143,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, unmap_rq: __blk_rq_unmap_user(bio); +fail: rq->bio = NULL; return -EINVAL; }