lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <610618d9-e983-fd56-ed0f-639428343af7@huawei.com>
Date:   Tue, 14 Apr 2020 10:13:28 +0800
From:   Wu Bo <wubo40@...wei.com>
To:     Doug Gilbert <dgilbert@...erlog.com>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        <linux-scsi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <liuzhiqiang26@...wei.com>, <linfeilong@...wei.com>
Subject: [PATCH] scsi:sg: add sg_remove_request in sg_write

From: Wu Bo <wubo40@...wei.com>

If the __copy_from_user function return failed,
it should call sg_remove_request in sg_write.

Signed-off-by: Wu Bo <wubo40@...wei.com>
---
  drivers/scsi/sg.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 4e6af59..ff3f532 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -685,8 +685,10 @@ static int get_sg_io_pack_id(int *pack_id, void 
__user *buf, size_t count)
         hp->flags = input_size; /* structure abuse ... */
         hp->pack_id = old_hdr.pack_id;
         hp->usr_ptr = NULL;
-       if (copy_from_user(cmnd, buf, cmd_size))
+       if (copy_from_user(cmnd, buf, cmd_size)) {
+               sg_remove_request(sfp, srp);
                 return -EFAULT;
+       }
         /*
          * SG_DXFER_TO_FROM_DEV is functionally equivalent to 
SG_DXFER_FROM_DEV,
          * but is is possible that the app intended SG_DXFER_TO_DEV, 
because there
--
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ