lkml.org 
[lkml]   [2015]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.4 041/172] sg: fix read() error reporting
    Date
    From: Tony Battersby <tonyb@cybernetics.com>

    3.4.108-rc1 review patch. If anyone has any objections, please let me know.

    ------------------


    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: Zefan Li <lizefan@huawei.com>
    ---
    drivers/scsi/sg.c | 6 +++---
    1 file changed, 3 insertions(+), 3 deletions(-)

    diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
    index eacd46b..fb119ce 100644
    --- a/drivers/scsi/sg.c
    +++ b/drivers/scsi/sg.c
    @@ -498,7 +498,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) {
    @@ -527,8 +527,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
    --
    1.9.1


    \
     
     \ /
      Last update: 2015-06-16 11:01    [W:7.768 / U:0.000 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site