Commit 7e959418 authored by Tony Battersby's avatar Tony Battersby Committed by Greg Kroah-Hartman

sg: fix read() error reporting

commit 3b524a68 upstream.

Fix SCSI generic read() incorrectly returning success after detecting an
error.
Signed-off-by: default avatarTony Battersby <tonyb@cybernetics.com>
Acked-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c7120339
...@@ -522,7 +522,7 @@ static ssize_t ...@@ -522,7 +522,7 @@ static ssize_t
sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp)
{ {
sg_io_hdr_t *hp = &srp->header; sg_io_hdr_t *hp = &srp->header;
int err = 0; int err = 0, err2;
int len; int len;
if (count < SZ_SG_IO_HDR) { 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) ...@@ -551,8 +551,8 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp)
goto err_out; goto err_out;
} }
err_out: err_out:
err = sg_finish_rem_req(srp); err2 = sg_finish_rem_req(srp);
return (0 == err) ? count : err; return err ? : err2 ? : count;
} }
static ssize_t static ssize_t
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment