diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-06 19:18:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-07 11:23:35 -0500 |
commit | a0ac402cfcdc904f9772e1762b3fda112dcc56a0 (patch) | |
tree | 6d4a89d91174c334881d9224bfcf9752ae75c8d3 /block/blk-map.c | |
parent | bc3913a5378cd0ddefd1dfec6917cc12eb23a946 (diff) |
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 <jthumshirn@suse.de>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'block/blk-map.c')
-rw-r--r-- | block/blk-map.c | 4 |
1 files changed, 4 insertions, 0 deletions
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, | |||
118 | struct iov_iter i; | 118 | struct iov_iter i; |
119 | int ret; | 119 | int ret; |
120 | 120 | ||
121 | if (!iter_is_iovec(iter)) | ||
122 | goto fail; | ||
123 | |||
121 | if (map_data) | 124 | if (map_data) |
122 | copy = true; | 125 | copy = true; |
123 | else if (iov_iter_alignment(iter) & align) | 126 | else if (iov_iter_alignment(iter) & align) |
@@ -140,6 +143,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, | |||
140 | 143 | ||
141 | unmap_rq: | 144 | unmap_rq: |
142 | __blk_rq_unmap_user(bio); | 145 | __blk_rq_unmap_user(bio); |
146 | fail: | ||
143 | rq->bio = NULL; | 147 | rq->bio = NULL; |
144 | return -EINVAL; | 148 | return -EINVAL; |
145 | } | 149 | } |