linux/net/hsr
Hangbin Liu 847748fc66 hsr: hold rcu and dev lock for hsr_get_port_ndev
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>
2025-09-11 11:49:19 +02:00
..
Kconfig
Makefile
hsr_debugfs.c
hsr_device.c hsr: hold rcu and dev lock for hsr_get_port_ndev 2025-09-11 11:49:19 +02:00
hsr_device.h
hsr_forward.c
hsr_forward.h
hsr_framereg.c
hsr_framereg.h
hsr_main.c hsr: use hsr_for_each_port_rtnl in hsr_port_get_hsr 2025-09-11 11:49:19 +02:00
hsr_main.h hsr: use rtnl lock when iterating over ports 2025-09-11 11:49:19 +02:00
hsr_netlink.c
hsr_netlink.h
hsr_slave.c
hsr_slave.h
prp_dup_discard_test.c