diff options
author | Tony Battersby <tonyb@cybernetics.com> | 2015-02-11 11:32:06 -0500 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2015-03-23 21:02:44 -0400 |
commit | 26a344876afaace358669f0f06894b9bce24ec09 (patch) | |
tree | d7ad60361ca5acd327ac2268d2876d4d7a63793f /drivers/scsi/sg.c | |
parent | 636697380e1189b5385aeef9b022a3a65024fba9 (diff) | |
download | lwn-26a344876afaace358669f0f06894b9bce24ec09.tar.gz lwn-26a344876afaace358669f0f06894b9bce24ec09.zip |
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: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'drivers/scsi/sg.c')
-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 843594c2583d..07b2ea1fbf0d 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 |