Commit 1178f66e authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

pppoe: RCU locking in get_item_by_addr()

Use dev_get_by_name_rcu() instead of dev_get_by_name(),
to avoid touching device refcount in hotpath.
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 05e8689c
...@@ -250,20 +250,19 @@ static inline struct pppox_sock *get_item_by_addr(struct net *net, ...@@ -250,20 +250,19 @@ static inline struct pppox_sock *get_item_by_addr(struct net *net,
{ {
struct net_device *dev; struct net_device *dev;
struct pppoe_net *pn; struct pppoe_net *pn;
struct pppox_sock *pppox_sock; struct pppox_sock *pppox_sock = NULL;
int ifindex; int ifindex;
dev = dev_get_by_name(net, sp->sa_addr.pppoe.dev); rcu_read_lock();
if (!dev) dev = dev_get_by_name_rcu(net, sp->sa_addr.pppoe.dev);
return NULL; if (dev) {
ifindex = dev->ifindex; ifindex = dev->ifindex;
pn = net_generic(net, pppoe_net_id); pn = net_generic(net, pppoe_net_id);
pppox_sock = get_item(pn, sp->sa_addr.pppoe.sid, pppox_sock = get_item(pn, sp->sa_addr.pppoe.sid,
sp->sa_addr.pppoe.remote, ifindex); sp->sa_addr.pppoe.remote, ifindex);
dev_put(dev); }
rcu_read_unlock();
return pppox_sock; return pppox_sock;
} }
......
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