]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: renesas: rswitch: avoid use-after-put for a device tree node
authorNikita Yushchenko <nikita.yoush@cogentembedded.com>
Sun, 8 Dec 2024 09:50:04 +0000 (14:50 +0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Dec 2024 17:13:17 +0000 (18:13 +0100)
commit92007a28f95413058a7268dc84e5f44b700165d1
treea19b2edbac7402567c11a60103d50be999e58219
parentdf3aa9c5600d14f76a39201466a16a4e0b975aa9
net: renesas: rswitch: avoid use-after-put for a device tree node

[ Upstream commit 66b7e9f85b8459c823b11e9af69dbf4be5eb6be8 ]

The device tree node saved in the rswitch_device structure is used at
several driver locations. So passing this node to of_node_put() after
the first use is wrong.

Move of_node_put() for this node to exit paths.

Fixes: b46f1e579329 ("net: renesas: rswitch: Simplify struct phy * handling")
Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://patch.msgid.link/20241208095004.69468-5-nikita.yoush@cogentembedded.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/renesas/rswitch.c