summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2018-01-15 01:00:48 +0300
committerJens Axboe <axboe@kernel.dk>2018-01-15 18:50:32 +0300
commit69e0927b3774563c19b5fb32e91d75edc147fb62 (patch)
tree597acc434317fb8ba709051e0ee68de2c288f649 /block
parentfa70d2e2c4a0a54ced98260c6a176cc94c876d27 (diff)
downloadlinux-69e0927b3774563c19b5fb32e91d75edc147fb62.tar.xz
blk_rq_map_user_iov: fix error override
During stress tests by syzkaller on the sg driver the block layer infrequently returns EINVAL. Closer inspection shows the block layer was trying to return ENOMEM (which is much more understandable) but for some reason overroad that useful error. Patch below does not show this (unchanged) line: ret =__blk_rq_map_user_iov(rq, map_data, &i, gfp_mask, copy); That 'ret' was being overridden when that function failed. Signed-off-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/blk-map.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/block/blk-map.c b/block/blk-map.c
index b21f8e86f120..209eb3b45c54 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -114,7 +114,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
unsigned long align = q->dma_pad_mask | queue_dma_alignment(q);
struct bio *bio = NULL;
struct iov_iter i;
- int ret;
+ int ret = -EINVAL;
if (!iter_is_iovec(iter))
goto fail;
@@ -143,7 +143,7 @@ unmap_rq:
__blk_rq_unmap_user(bio);
fail:
rq->bio = NULL;
- return -EINVAL;
+ return ret;
}
EXPORT_SYMBOL(blk_rq_map_user_iov);