Skip to content

Commit

Permalink
Don't feed anything but regular iovec's to blk_rq_map_user_iov
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Al Viro <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
torvalds committed Dec 7, 2016
1 parent bc3913a commit a0ac402
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions block/blk-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}
Expand Down

0 comments on commit a0ac402

Please sign in to comment.