realtek: dsa: avoid use-after-free
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Sun, 11 Jan 2026 19:31:20 +0000 (20:31 +0100)
committerStijn Tintel <stijn@linux-ipv6.be>
Mon, 12 Jan 2026 12:47:39 +0000 (14:47 +0200)
commita91c3abe83c3f9513518c86b5d0a42b5a9afaad3
tree87badade330b3c6a7e18c302c6494048cb4b7b94
parent6ac605e4c61746c2c4fbf24a705508de7fc67d7f
realtek: dsa: avoid use-after-free

The realtek target uses some functions marked __init for initialization.
However, that means they can only be called once when compiled in and
afterwards the memory occupied by them is freed and potentially reused.
Some "impossible" (code at a given location can't crash in the way it
does) crashes can be caused by this because upon re-execution of those
functions, garbage gets executed. Such re-execution can happen for
deferred probes or repeated probes.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Link: https://github.com/openwrt/openwrt/pull/21504
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c
target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c