mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
net: RCU conversion of dev_getbyhwaddr() and arp_ioctl()
Le dimanche 05 décembre 2010 à 09:19 +0100, Eric Dumazet a écrit : > Hmm.. > > If somebody can explain why RTNL is held in arp_ioctl() (and therefore > in arp_req_delete()), we might first remove RTNL use in arp_ioctl() so > that your patch can be applied. > > Right now it is not good, because RTNL wont be necessarly held when you > are going to call arp_invalidate() ? While doing this analysis, I found a refcount bug in llc, I'll send a patch for net-2.6 Meanwhile, here is the patch for net-next-2.6 Your patch then can be applied after mine. Thanks [PATCH] net: RCU conversion of dev_getbyhwaddr() and arp_ioctl() dev_getbyhwaddr() was called under RTNL. Rename it to dev_getbyhwaddr_rcu() and change all its caller to now use RCU locking instead of RTNL. Change arp_ioctl() to use RCU instead of RTNL locking. Note: this fix a dev refcount bug in llc Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
a2d4b65d47
commit
941666c2e3
5 changed files with 27 additions and 27 deletions
|
|
@ -316,9 +316,9 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)
|
|||
if (unlikely(addr->sllc_family != AF_LLC))
|
||||
goto out;
|
||||
rc = -ENODEV;
|
||||
rtnl_lock();
|
||||
rcu_read_lock();
|
||||
if (sk->sk_bound_dev_if) {
|
||||
llc->dev = dev_get_by_index(&init_net, sk->sk_bound_dev_if);
|
||||
llc->dev = dev_get_by_index_rcu(&init_net, sk->sk_bound_dev_if);
|
||||
if (llc->dev) {
|
||||
if (!addr->sllc_arphrd)
|
||||
addr->sllc_arphrd = llc->dev->type;
|
||||
|
|
@ -329,14 +329,15 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen)
|
|||
!llc_mac_match(addr->sllc_mac,
|
||||
llc->dev->dev_addr)) {
|
||||
rc = -EINVAL;
|
||||
dev_put(llc->dev);
|
||||
llc->dev = NULL;
|
||||
}
|
||||
}
|
||||
} else
|
||||
llc->dev = dev_getbyhwaddr(&init_net, addr->sllc_arphrd,
|
||||
llc->dev = dev_getbyhwaddr_rcu(&init_net, addr->sllc_arphrd,
|
||||
addr->sllc_mac);
|
||||
rtnl_unlock();
|
||||
if (llc->dev)
|
||||
dev_hold(llc->dev);
|
||||
rcu_read_unlock();
|
||||
if (!llc->dev)
|
||||
goto out;
|
||||
if (!addr->sllc_sap) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue