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-prev] [day] [month] [year] [list]
Date:   Wed, 11 May 2022 16:19:48 +0300
From:   Oded Gabbay <ogabbay@...nel.org>
To:     linux-kernel@...r.kernel.org
Cc:     kernel test robot <lkp@...el.com>,
        Dan Carpenter <dan.carpenter@...cle.com>
Subject: [PATCH 3/3] habanalabs: return -EFAULT on copy_to_user error

If copy_to_user failed in info ioctl, we always return -EFAULT so the
user will know there was an error.

Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Oded Gabbay <ogabbay@...nel.org>
---
 drivers/misc/habanalabs/common/habanalabs_ioctl.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/misc/habanalabs/common/habanalabs_ioctl.c b/drivers/misc/habanalabs/common/habanalabs_ioctl.c
index 51fa56287309..8fd2b427863f 100644
--- a/drivers/misc/habanalabs/common/habanalabs_ioctl.c
+++ b/drivers/misc/habanalabs/common/habanalabs_ioctl.c
@@ -118,7 +118,6 @@ static int hw_events_info(struct hl_device *hdev, bool aggregate,
 
 static int events_info(struct hl_fpriv *hpriv, struct hl_info_args *args)
 {
-	int rc;
 	u32 max_size = args->return_size;
 	u64 events_mask;
 	void __user *out = (void __user *) (uintptr_t) args->return_pointer;
@@ -131,8 +130,7 @@ static int events_info(struct hl_fpriv *hpriv, struct hl_info_args *args)
 	hpriv->notifier_event.events_mask = 0;
 	mutex_unlock(&hpriv->notifier_event.lock);
 
-	rc = copy_to_user(out, &events_mask, sizeof(u64));
-	return rc;
+	return copy_to_user(out, &events_mask, sizeof(u64)) ? -EFAULT : 0;
 }
 
 static int dram_usage_info(struct hl_fpriv *hpriv, struct hl_info_args *args)
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ