Skip to content

Commit

Permalink
decnet: add RTNL lock when reading address list
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
stephen hemminger authored and davem330 committed Nov 12, 2009
1 parent 08e9897 commit 41bdecf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/decnet/dn_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 41bdecf

Please sign in to comment.