summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWentao Liang <vulab@iscas.ac.cn>2026-04-07 07:30:25 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-07-04 13:44:20 +0200
commit2205275be9be981e70ff29610b0117d8853fac70 (patch)
tree4b5fe7de2b15df0f1f3d24824e562f5d787cdbb1
parent720949ed666f34ff28ffdfe1471a5861d1e41fdf (diff)
downloadlinux-stable-2205275be9be981e70ff29610b0117d8853fac70.tar.gz
linux-stable-2205275be9be981e70ff29610b0117d8853fac70.zip
power: reset: linkstation-poweroff: fix use-after-free in the linkstation_poweroff_init()
commit 8eec545cde69e46e9a1d2b7d915ce4f5df85b3bd upstream. Move of_node_put(dn) after the of_match_node() call, which still needs the node pointer. The node reference is correctly released after use. Fixes: e2f471efe1d6 ("power: reset: linkstation-poweroff: prepare for new devices") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Link: https://patch.msgid.link/20260407073025.271865-1-vulab@iscas.ac.cn Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/power/reset/linkstation-poweroff.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/power/reset/linkstation-poweroff.c b/drivers/power/reset/linkstation-poweroff.c
index 02f5fdb8ffc4..e56d75bfcc43 100644
--- a/drivers/power/reset/linkstation-poweroff.c
+++ b/drivers/power/reset/linkstation-poweroff.c
@@ -163,10 +163,10 @@ static int __init linkstation_poweroff_init(void)
dn = of_find_matching_node(NULL, ls_poweroff_of_match);
if (!dn)
return -ENODEV;
- of_node_put(dn);
match = of_match_node(ls_poweroff_of_match, dn);
cfg = match->data;
+ of_node_put(dn);
dn = of_find_node_by_name(NULL, cfg->mdio_node_name);
if (!dn)