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>] [day] [month] [year] [list]
Message-Id: <20250509022554.27001-1-zhangzihuan@kylinos.cn>
Date: Fri,  9 May 2025 10:25:54 +0800
From: Zihuan Zhang <zhangzihuan@...inos.cn>
To: jikos@...nel.org,
	bentiss@...nel.org
Cc: linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Zihuan Zhang <zhangzihuan@...inos.cn>
Subject: [PATCH v1] HID: debug: Use the __set_current_state()

When detecting an invalid list->hdev, the process needs to manually set
its state to TASK_RUNNING and exit. In the original code,
set_current_state() (which includes a memory barrier) is used here, but
it is immediately followed by a mutex_unlock() call. Since
mutex_unlock() internally includes a memory barrier, this ensures that
all modifications within the critical section (including the process
state) are visible to other CPUs. Therefore, replacing it with
__set_current_state() (without an implicit barrier) avoids redundant
memory barriers.

Signed-off-by: Zihuan Zhang <zhangzihuan@...inos.cn>
---
 drivers/hid/hid-debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index 8433306148d5..00a73983ef19 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -3726,7 +3726,7 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer,
 			 */
 			if (!list->hdev || !list->hdev->debug) {
 				ret = -EIO;
-				set_current_state(TASK_RUNNING);
+				__set_current_state(TASK_RUNNING);
 				goto out;
 			}
 
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ