diff options
author | Tony Battersby <tonyb@cybernetics.com> | 2015-02-11 17:32:06 +0100 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2015-02-15 19:36:55 +0100 |
commit | 3b524a683af8991b4eab4182b947c65f0ce1421b (patch) | |
tree | 3a91b1a2f2c3b192a8f4b1c806a896c33404d810 /drivers | |
parent | wd719x: add missing .module to wd719x_template (diff) | |
download | linux-3b524a683af8991b4eab4182b947c65f0ce1421b.tar.xz linux-3b524a683af8991b4eab4182b947c65f0ce1421b.zip |
sg: fix read() error reporting
Fix SCSI generic read() incorrectly returning success after detecting an
error.
Cc: <stable@vger.kernel.org>
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/sg.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index a668c88ea150..6ad1480e87b7 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -546,7 +546,7 @@ static ssize_t sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) { sg_io_hdr_t *hp = &srp->header; - int err = 0; + int err = 0, err2; int len; if (count < SZ_SG_IO_HDR) { @@ -575,8 +575,8 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) goto err_out; } err_out: - err = sg_finish_rem_req(srp); - return (0 == err) ? count : err; + err2 = sg_finish_rem_req(srp); + return err ? : err2 ? : count; } static ssize_t |