diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2015-06-26 11:44:46 +0200 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-06-27 19:43:34 +0200 |
commit | 2c4cffe85170a001c1d092681c86aa1128295221 (patch) | |
tree | c79d5bc1a94c2b6886826e170decad8f55cd6c2a /block/scsi_ioctl.c | |
parent | NVMe: Fix filesystem deadlock on removal (diff) | |
download | linux-2c4cffe85170a001c1d092681c86aa1128295221.tar.xz linux-2c4cffe85170a001c1d092681c86aa1128295221.zip |
block: fix bogus EFAULT error from SG_IO ioctl
Whenever blk_fill_sghdr_rq fails, its errno code is ignored and changed to
EFAULT. This can cause very confusing errors:
$ sg_persist -k /dev/sda
persistent reservation in: pass through os error: Bad address
The fix is trivial, just propagate the return value from
blk_fill_sghdr_rq.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to '')
-rw-r--r-- | block/scsi_ioctl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 55b6f15dac90..dda653ce7b24 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -326,8 +326,8 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, goto out_put_request; } - ret = -EFAULT; - if (blk_fill_sghdr_rq(q, rq, hdr, mode)) + ret = blk_fill_sghdr_rq(q, rq, hdr, mode); + if (ret < 0) goto out_free_cdb; ret = 0; |