ipv6: replace write lock with read lock in addrconf_permanent_addr
Subsystems (3)
PATCH 1/1 ipv6: replace write lock with read lock in addrconf_permanent_addr
From: Li RongQing <[email protected]>
nothing of idev is changed, so read lock is enough
Signed-off-by Li RongQing <[email protected]>
--- net/ipv6/addrconf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/ipv6/addrconf.c +4 -4
@@ -3228,21 +3228,21 @@ static void addrconf_permanent_addr(struct net_device *dev)if (!idev)return ; -write_lock_bh (&idev->lock); +read_lock_bh (&idev->lock);list_for_each_entry_safe (ifp, tmp, &idev->addr_list, if_list) {if ((ifp->flags &IFA_F_PERMANENT ) &&fixup_permanent_addr (idev, ifp) <0 ) { -write_unlock_bh (&idev->lock); +read_unlock_bh (&idev->lock);ipv6_del_addr (ifp); -write_lock_bh (&idev->lock); +read_lock_bh (&idev->lock);net_info_ratelimited ("%s: Failed to add prefix route for address %pI6c; dropping\n" , idev->dev->name, &ifp->addr); } } -write_unlock_bh (&idev->lock); +read_unlock_bh (&idev->lock); } static int addrconf_notify(struct notifier_block *this, unsigned long event,
Signature · 1 line
2.1.4
David Miller
maintainerFrom: [email protected]
Date: Mon, 14 Mar 2016 17:35:08 +0800
Quoted 5 lines
From: Li RongQing <[email protected]>
nothing of idev is changed, so read lock is enough
Signed-off-by Li RongQing <[email protected]>
We need it for the modifications made by fixup_permanent_addr().
Quoted 2 lines · David Miller
We need it for the modifications made by
fixup_permanent_addr().
fixup_permanent_addr should be protected by ifp->lock, not by idev->lock write lock, since ifp is modified,
-Roy