Commit 847748fc authored by Hangbin Liu's avatar Hangbin Liu Committed by Paolo Abeni
Browse files

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: default avatarPaolo Abeni <pabeni@redhat.com>
Fixes: 9c10dd8e ("net: hsr: Create and export hsr_get_port_ndev()")
Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250905091533.377443-4-liuhangbin@gmail.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 393c841f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment