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: <20250414141143.1904-1-chenyufeng@iie.ac.cn>
Date: Mon, 14 Apr 2025 22:11:43 +0800
From: Chen Yufeng <chenyufeng@....ac.cn>
To: krzk@...nel.org
Cc: davem@...emloft.net,
	edumazet@...gle.com,
	kuba@...nel.org,
	pabeni@...hat.com,
	horms@...nel.org,
	netdev@...r.kernel.org,
	Chen Yufeng <chenyufeng@....ac.cn>
Subject: [PATCH]nfc: replace improper check device_is_registered() in nfc_se_io()

A patch similar to commit da5c0f119203 ("nfc: replace improper check device_is_registered() in netlink related functions")

The nfc_se_io() function in the NFC subsystem suffers from a race 
condition similar to previously reported issues in other netlink-related 
functions. The function checks device status using device_is_registered(),
but this check can race with device unregistration despite being protected
by device_lock.

This patch also uses bool variable dev->shutting_down instead of
device_is_registered() to judge whether the nfc device is registered,
which is well synchronized.

Signed-off-by: Chen Yufeng <chenyufeng@....ac.cn>
---
 net/nfc/netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index 6a40b8d0350d..6de0f5a18a87 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -1426,7 +1426,7 @@ static int nfc_se_io(struct nfc_dev *dev, u32 se_idx,
 
 	device_lock(&dev->dev);
 
-	if (!device_is_registered(&dev->dev)) {
+	if (dev->shutting_down) {
 		rc = -ENODEV;
 		goto error;
 	}
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ