Commit 979aad40 authored by Eric Dumazet's avatar Eric Dumazet Committed by Paolo Abeni

rtnetlink: do not depend on RTNL in rtnl_xdp_prog_skb()

dev->xdp_prog is protected by RCU, we can lift RTNL requirement
from rtnl_xdp_prog_skb().
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 6890ab31
......@@ -1477,13 +1477,15 @@ static int rtnl_fill_link_ifmap(struct sk_buff *skb,
static u32 rtnl_xdp_prog_skb(struct net_device *dev)
{
const struct bpf_prog *generic_xdp_prog;
u32 res = 0;
ASSERT_RTNL();
rcu_read_lock();
generic_xdp_prog = rcu_dereference(dev->xdp_prog);
if (generic_xdp_prog)
res = generic_xdp_prog->aux->id;
rcu_read_unlock();
generic_xdp_prog = rtnl_dereference(dev->xdp_prog);
if (!generic_xdp_prog)
return 0;
return generic_xdp_prog->aux->id;
return res;
}
static u32 rtnl_xdp_prog_drv(struct net_device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment