]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
hsr: use rtnl lock when iterating over ports
authorHangbin Liu <liuhangbin@gmail.com>
Fri, 5 Sep 2025 09:15:31 +0000 (09:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Sep 2025 14:37:37 +0000 (16:37 +0200)
commit4fb6bcc1e68f6b2e050bb76c49a9b4800ff5f973
treea8717c6be8858871cc9e204335aa02629acb8887
parent3f9f4764f8478e70cefb95747177409665f79005
hsr: use rtnl lock when iterating over ports

[ Upstream commit 8884c693991333ae065830554b9b0c96590b1bb2 ]

hsr_for_each_port is called in many places without holding the RCU read
lock, this may trigger warnings on debug kernels. Most of the callers
are actually hold rtnl lock. So add a new helper hsr_for_each_port_rtnl
to allow callers in suitable contexts to iterate ports safely without
explicit RCU locking.

This patch only fixed the callers that is hold rtnl lock. Other caller
issues will be fixed in later patches.

Fixes: c5a759117210 ("net/hsr: Use list_head (and rcu) instead of array for slave devices.")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250905091533.377443-2-liuhangbin@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/hsr/hsr_device.c
net/hsr/hsr_main.c
net/hsr/hsr_main.h