Skip to content

Commit 2205275

Browse files
ISCAS-Vulabgregkh
authored andcommitted
power: reset: linkstation-poweroff: fix use-after-free in the linkstation_poweroff_init()
commit 8eec545 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: e2f471e ("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>
1 parent 720949e commit 2205275

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/power/reset/linkstation-poweroff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ static int __init linkstation_poweroff_init(void)
163163
dn = of_find_matching_node(NULL, ls_poweroff_of_match);
164164
if (!dn)
165165
return -ENODEV;
166-
of_node_put(dn);
167166

168167
match = of_match_node(ls_poweroff_of_match, dn);
169168
cfg = match->data;
169+
of_node_put(dn);
170170

171171
dn = of_find_node_by_name(NULL, cfg->mdio_node_name);
172172
if (!dn)

0 commit comments

Comments
 (0)