summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2009-11-11 07:39:27 +0000
committerDavid S. Miller <davem@davemloft.net>2009-11-11 19:22:15 -0800
commit41bdecf17e6dba92256c65972ec79a482d978be5 (patch)
treef0fb46bda6bc72483a30bb726cf35ffdf77cbf0c /net
parent08e9897d512fe7a67e46209543b3815b57a36dc7 (diff)
downloadlinux-3.10-41bdecf17e6dba92256c65972ec79a482d978be5.tar.gz
linux-3.10-41bdecf17e6dba92256c65972ec79a482d978be5.tar.bz2
linux-3.10-41bdecf17e6dba92256c65972ec79a482d978be5.zip
decnet: add RTNL lock when reading address list
Add missing locking in the case of auto binding to the default device. The address list might change while this code is looking at the list. Compile tested only, I am not a decnet user. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/decnet/dn_dev.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index b5ef237c8a7..5790d660bc7 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -828,13 +828,17 @@ static int dn_dev_get_first(struct net_device *dev, __le16 *addr)
struct dn_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
struct dn_ifaddr *ifa;
int rv = -ENODEV;
+
if (dn_db == NULL)
goto out;
+
+ rtnl_lock();
ifa = dn_db->ifa_list;
if (ifa != NULL) {
*addr = ifa->ifa_local;
rv = 0;
}
+ rtnl_unlock();
out:
return rv;
}