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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241206-of_core_fix-v1-2-dc28ed56bec3@quicinc.com>
Date: Fri, 06 Dec 2024 08:52:28 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>, 
 Leif Lindholm <leif.lindholm@...aro.org>, 
 Stephen Boyd <stephen.boyd@...aro.org>, Maxime Ripard <mripard@...nel.org>, 
 Robin Murphy <robin.murphy@....com>, 
 Grant Likely <grant.likely@...retlab.ca>
Cc: Zijun Hu <zijun_hu@...oud.com>, devicetree@...r.kernel.org, 
 linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>, 
 stable@...r.kernel.org
Subject: [PATCH 02/10] of: Correct return value for API
 of_parse_phandle_with_args_map()

From: Zijun Hu <quic_zijuhu@...cinc.com>

@ret is used by of_parse_phandle_with_args_map() to record return value
and it is preseted with -EINVAL before the outer while loop, but it is
changed to 0 by below successful operation within the inner loop:
of_property_read_u32(new, cells_name, &new_size)

So cause 0(success) is returned for all failures which happen after the
operation, that is obviously wrong.

Fix by restoring @ret with preseted -EINVAL after the operation.

Fixes: bd6f2fd5a1d5 ("of: Support parsing phandle argument lists through a nexus node")
Cc: stable@...r.kernel.org
Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
 drivers/of/base.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 9a9313183d1f1b61918fe7e6fa80c2726b099a1c..b294924aa31cfed1ec06983f420a445f7fae7394 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1516,6 +1516,8 @@ int of_parse_phandle_with_args_map(const struct device_node *np,
 			ret = of_property_read_u32(new, cells_name, &new_size);
 			if (ret)
 				goto put;
+			/* Restore preseted error code */
+			ret = -EINVAL;
 
 			/* Check for malformed properties */
 			if (WARN_ON(new_size > MAX_PHANDLE_ARGS))

-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ