linux-yocto/net/hsr
Hangbin Liu 68a6729afd hsr: hold rcu and dev lock for hsr_get_port_ndev
[ Upstream commit 847748fc66d08a89135a74e29362a66ba4e3ab15 ]

hsr_get_port_ndev calls hsr_for_each_port, which need to hold rcu lock.
On the other hand, before return the port device, we need to hold the
device reference to avoid UaF in the caller function.

Suggested-by: Paolo Abeni <pabeni@redhat.com>
Fixes: 9c10dd8eed ("net: hsr: Create and export hsr_get_port_ndev()")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250905091533.377443-4-liuhangbin@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-09-19 16:37:38 +02:00
..
hsr_debugfs.c saner replacement for debugfs_rename() 2025-01-15 13:14:37 +01:00
hsr_device.c hsr: hold rcu and dev lock for hsr_get_port_ndev 2025-09-19 16:37:38 +02:00
hsr_device.h net: hsr: Provide RedBox support (HSR-SAN) 2024-04-26 12:04:43 +02:00
hsr_forward.c net: hsr: Fix PRP duplicate detection 2025-03-13 10:04:22 +01:00
hsr_forward.h
hsr_framereg.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
hsr_framereg.h net: hsr: Fix PRP duplicate detection 2025-03-13 10:04:22 +01:00
hsr_main.c hsr: use hsr_for_each_port_rtnl in hsr_port_get_hsr 2025-09-19 16:37:38 +02:00
hsr_main.h hsr: use rtnl lock when iterating over ports 2025-09-19 16:37:37 +02:00
hsr_netlink.c net: Use link/peer netns in newlink() of rtnl_link_ops 2025-02-21 15:28:02 -08:00
hsr_netlink.h net/hsr: Remove unused function declarations 2023-07-31 20:11:47 -07:00
hsr_slave.c net, hsr: reject HSR frame if skb can't hold tag 2025-08-28 16:34:31 +02:00
hsr_slave.h
Kconfig net: hsr: Add KUnit test for PRP 2025-03-13 10:04:22 +01:00
Makefile net: hsr: Add KUnit test for PRP 2025-03-13 10:04:22 +01:00
prp_dup_discard_test.c net: hsr: Add KUnit test for PRP 2025-03-13 10:04:22 +01:00