blk_rq_map_user_iov: fix error override
authorDouglas Gilbert <dgilbert@interlog.com>
Sun, 14 Jan 2018 22:00:48 +0000 (17:00 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Feb 2018 10:05:42 +0000 (11:05 +0100)
commit7abb5e9dd5683d693376635ff05ec729216fd726
treeddbfb2f4e6724cd35bf0d1bf939c9123374b2422
parent3ee287d35b25076b626898284d610465145aa43b
blk_rq_map_user_iov: fix error override

commit 69e0927b3774563c19b5fb32e91d75edc147fb62 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/blk-map.c