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]
Date: Fri, 14 Jun 2024 00:01:34 +0900
From: Gyeonggeon Choi <gychoi.dev@...il.com>
To: robh@...nel.org,
	saravanak@...gle.com
Cc: devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Gyeonggeon Choi <gychoi.dev@...il.com>
Subject: [PATCH] drivers:of: Add null check for bus in of_match_bus

Added a null check for the bus variable after calling of_match_bus.
This prevents potential null pointer dereference errors in subsequent
code, where bus->count_cells could cause a crash if bus is NULL.

Signed-off-by: Gyeonggeon Choi <gychoi.dev@...il.com>
---
 drivers/of/address.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/of/address.c b/drivers/of/address.c
index d669ce25b5f9..85f986d25870 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -504,6 +504,8 @@ static u64 __of_translate_address(struct device_node *node,
 	if (parent == NULL)
 		return OF_BAD_ADDR;
 	bus = of_match_bus(parent);
+	if (bus == NULL)
+		return OF_BAD_ADDR;
 
 	/* Count address cells & copy address locally */
 	bus->count_cells(dev, &na, &ns);
-- 
2.39.3 (Apple Git-146)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ