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: <20250714175720.3394568-1-alok.a.tiwari@oracle.com>
Date: Mon, 14 Jul 2025 10:57:17 -0700
From: Alok Tiwari <alok.a.tiwari@...cle.com>
To: sayantan.nandy@...oha.com, lorenzo@...nel.org, andrew+netdev@...n.ch,
        davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, horms@...nel.org, netdev@...r.kernel.org,
        linux-mediatek@...ts.infradead.org
Cc: alok.a.tiwari@...cle.com, linux-arm-kernel@...ts.infradead.org
Subject: [PATCH net] net: airoha: fix potential use-after-free in airoha_npu_get()

np->name was being used after calling of_node_put(np), which
releases the node and can lead to a use-after-free bug.
Store the name in a local variable before releasing the
node to avoid potential issues.

Fixes: 23290c7bc190 ("net: airoha: Introduce Airoha NPU support")
Signed-off-by: Alok Tiwari <alok.a.tiwari@...cle.com>
---
 drivers/net/ethernet/airoha/airoha_npu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/airoha/airoha_npu.c b/drivers/net/ethernet/airoha/airoha_npu.c
index 0e5b8c21b9aa8..30cd617232244 100644
--- a/drivers/net/ethernet/airoha/airoha_npu.c
+++ b/drivers/net/ethernet/airoha/airoha_npu.c
@@ -400,11 +400,12 @@ struct airoha_npu *airoha_npu_get(struct device *dev, dma_addr_t *stats_addr)
 	if (!np)
 		return ERR_PTR(-ENODEV);
 
+	const char *np_name = np->name;
 	pdev = of_find_device_by_node(np);
 	of_node_put(np);
 
 	if (!pdev) {
-		dev_err(dev, "cannot find device node %s\n", np->name);
+		dev_err(dev, "cannot find device node %s\n", np_name);
 		return ERR_PTR(-ENODEV);
 	}
 
-- 
2.46.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ