aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-11-01 14:51:22 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-02 02:55:13 -0500
commit1178f66eaea968d093cafd37c226ebeaa70d56cf (patch)
tree928b540a54d4a8486a73d9a1387cda326dcedef1
parent05e8689c9a3a208bf75b60662778d81e23eac460 (diff)
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: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/pppoe.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 2559991eea6a..60c8d233209f 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -250,20 +250,19 @@ static inline struct pppox_sock *get_item_by_addr(struct net *net,
250{ 250{
251 struct net_device *dev; 251 struct net_device *dev;
252 struct pppoe_net *pn; 252 struct pppoe_net *pn;
253 struct pppox_sock *pppox_sock; 253 struct pppox_sock *pppox_sock = NULL;
254 254
255 int ifindex; 255 int ifindex;
256 256
257 dev = dev_get_by_name(net, sp->sa_addr.pppoe.dev); 257 rcu_read_lock();
258 if (!dev) 258 dev = dev_get_by_name_rcu(net, sp->sa_addr.pppoe.dev);
259 return NULL; 259 if (dev) {
260 260 ifindex = dev->ifindex;
261 ifindex = dev->ifindex; 261 pn = net_generic(net, pppoe_net_id);
262 pn = net_generic(net, pppoe_net_id); 262 pppox_sock = get_item(pn, sp->sa_addr.pppoe.sid,
263 pppox_sock = get_item(pn, sp->sa_addr.pppoe.sid,
264 sp->sa_addr.pppoe.remote, ifindex); 263 sp->sa_addr.pppoe.remote, ifindex);
265 dev_put(dev); 264 }
266 265 rcu_read_unlock();
267 return pppox_sock; 266 return pppox_sock;
268} 267}
269 268