linux/net/hsr
Hangbin Liu 9433ba79c2 hsr: hold rcu and dev lock for hsr_get_port_ndev
[ Upstream commit 847748fc66 ]

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>
[ Drop multicast filtering changes ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-01-08 10:14:27 +01:00
..
hsr_debugfs.c Revert "net: hsr: use hlist_head instead of list_head for mac addresses" 2022-12-01 20:26:20 -08:00
hsr_device.c hsr: hold rcu and dev lock for hsr_get_port_ndev 2026-01-08 10:14:27 +01: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 NULL pointer dereference in prp_get_untagged_frame() 2026-01-08 10:14:08 +01:00
hsr_forward.h net: hsr: fix mac_len checks 2021-05-24 14:10:28 -07:00
hsr_framereg.c net: hsr: Fix PRP duplicate detection 2025-05-29 11:02:20 +02:00
hsr_framereg.h net: hsr: Fix PRP duplicate detection 2025-05-29 11:02:20 +02:00
hsr_main.c hsr: use hsr_for_each_port_rtnl in hsr_port_get_hsr 2025-09-19 16:35:50 +02:00
hsr_main.h net: hsr: Create and export hsr_get_port_ndev() 2025-12-18 13:55:14 +01:00
hsr_netlink.c net: hsr: remove seqnr_lock 2024-09-09 10:25:01 +01:00
hsr_netlink.h net/hsr: Remove unused function declarations 2023-07-31 20:11:47 -07:00
hsr_slave.c net: hsr: create an API to get hsr port type 2025-12-18 13:55:14 +01:00
hsr_slave.h net: prp: add packet handling support 2020-07-27 12:20:40 -07:00
Kconfig hsr: enhance netlink socket interface to support PRP 2020-07-27 12:20:40 -07:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00