aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi
diff options
context:
space:
mode:
authorTony Battersby <tonyb@cybernetics.com>2015-02-11 11:32:06 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-18 13:22:33 +0100
commit7e95941876b4eaeec3052dc5fa998ff5f7096e7d (patch)
tree386ded6a8d12507aeec6837bcf1b9a81e77a457d /drivers/scsi
parentc7120339ac0391877be7013a8c5bf9dafeb3e984 (diff)
downloadlinux-linaro-stable-7e95941876b4eaeec3052dc5fa998ff5f7096e7d.tar.gz
sg: fix read() error reporting
commit 3b524a683af8991b4eab4182b947c65f0ce1421b upstream. Fix SCSI generic read() incorrectly returning success after detecting an error. Signed-off-by: Tony Battersby <tonyb@cybernetics.com> Acked-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/sg.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index df5e961484e1..eb81c98386b9 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -522,7 +522,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) {
@@ -551,8 +551,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