mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
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>
This commit is contained in:
parent
08e9897d51
commit
41bdecf17e
1 changed files with 4 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue