summaryrefslogtreecommitdiffstats
path: root/block/scsi_ioctl.c
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2014-08-26 16:14:02 +0200
committerJens Axboe <axboe@fb.com>2014-08-26 08:20:01 -0600
commitd19d744685f47f1bb3d39b3ec51eb50afe5ff47d (patch)
treee3056acc30ff3e7d928c9d074fd7d22263bc9e66 /block/scsi_ioctl.c
parent2ba136daa3ae1e881c9f586f283fcaa164767dce (diff)
downloadlinux-stable-d19d744685f47f1bb3d39b3ec51eb50afe5ff47d.tar.gz
linux-stable-d19d744685f47f1bb3d39b3ec51eb50afe5ff47d.tar.bz2
linux-stable-d19d744685f47f1bb3d39b3ec51eb50afe5ff47d.zip
block: fix error handling in sg_io
Before commit 2cada584b200 ("block: cleanup error handling in sg_io"), we had ret = 0 before entering the last big if block of sg_io. Since 2cada584b200, ret = -EFAULT, which breaks hdparm: /dev/sda: setting Advanced Power Management level to 0xc8 (200) HDIO_DRIVE_CMD failed: Bad address APM_level = 128 Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Fixes: 2cada584b200 ("block: cleanup error handling in sg_io") Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/scsi_ioctl.c')
-rw-r--r--block/scsi_ioctl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 5dd477bfb4bc..9b8eaeca6a79 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -330,6 +330,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
if (blk_fill_sghdr_rq(q, rq, hdr, mode))
goto out_free_cdb;
+ ret = 0;
if (hdr->iovec_count) {
size_t iov_data_len;
struct iovec *iov = NULL;