Skip to content

Commit 69e0927

Browse files
doug-gilbertaxboe
authored andcommitted
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>
1 parent fa70d2e commit 69e0927

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎block/blk-map.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
114114
unsigned long align = q->dma_pad_mask | queue_dma_alignment(q);
115115
struct bio *bio = NULL;
116116
struct iov_iter i;
117-
int ret;
117+
int ret = -EINVAL;
118118

119119
if (!iter_is_iovec(iter))
120120
goto fail;
@@ -143,7 +143,7 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
143143
__blk_rq_unmap_user(bio);
144144
fail:
145145
rq->bio = NULL;
146-
return -EINVAL;
146+
return ret;
147147
}
148148
EXPORT_SYMBOL(blk_rq_map_user_iov);
149149

0 commit comments

Comments
 (0)