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>
This commit is contained in:
Tony Battersby 2015-02-11 11:32:06 -05:00 коммит произвёл James Bottomley
Родитель 2ecf8e0ae2
Коммит 3b524a683a
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -546,7 +546,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) {
@ -575,8 +575,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