Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1735415

[PATCH] mpt3sas: downgrade full copy_from_user to access_ok check

From Meng Xu <mengxu.gatech@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] mpt3sas: downgrade full copy_from_user to access_ok check
Date 2017-09-20 05:20 +0200
Message-ID <urDIl-5IT-11@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Since right after the user copy, we are going to
memset(&karg, 0, sizeof(karg)), I guess an access_ok check is enough?

Signed-off-by: Meng Xu <mengxu.gatech@gmail.com>
---
 drivers/scsi/mpt3sas/mpt3sas_ctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index bdffb69..b363d2d 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -1065,7 +1065,7 @@ _ctl_getiocinfo(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
 {
 	struct mpt3_ioctl_iocinfo karg;
 
-	if (copy_from_user(&karg, arg, sizeof(karg))) {
+	if (!access_ok(VERIFY_READ, arg, sizeof(karg))) {
 		pr_err("failure at %s:%d/%s()!\n",
 		    __FILE__, __LINE__, __func__);
 		return -EFAULT;
-- 
2.7.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] mpt3sas: downgrade full copy_from_user to access_ok check Meng Xu <mengxu.gatech@gmail.com> - 2017-09-20 05:20 +0200
  Re: [PATCH] mpt3sas: downgrade full copy_from_user to access_ok check Christoph Hellwig <hch@infradead.org> - 2017-09-20 17:10 +0200
  Re: [PATCH] mpt3sas: downgrade full copy_from_user to access_ok check Al Viro <viro@ZenIV.linux.org.uk> - 2017-09-21 05:30 +0200
    Re: [PATCH] mpt3sas: downgrade full copy_from_user to access_ok check Meng Xu <mengxu.gatech@gmail.com> - 2017-09-21 05:40 +0200

csiph-web