Commit 41bdecf1 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

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: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 08e9897d
...@@ -828,13 +828,17 @@ static int dn_dev_get_first(struct net_device *dev, __le16 *addr) ...@@ -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_dev *dn_db = (struct dn_dev *)dev->dn_ptr;
struct dn_ifaddr *ifa; struct dn_ifaddr *ifa;
int rv = -ENODEV; int rv = -ENODEV;
if (dn_db == NULL) if (dn_db == NULL)
goto out; goto out;
rtnl_lock();
ifa = dn_db->ifa_list; ifa = dn_db->ifa_list;
if (ifa != NULL) { if (ifa != NULL) {
*addr = ifa->ifa_local; *addr = ifa->ifa_local;
rv = 0; rv = 0;
} }
rtnl_unlock();
out: out:
return rv; return rv;
} }
......
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