diff options
author | David Ahern <dsa@cumulusnetworks.com> | 2016-10-17 19:15:52 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-10-18 11:45:00 -0400 |
commit | 0f524a80ff35af8a7664d7661d948107da142e04 (patch) | |
tree | 25d8cfded791067a137c52852f32ac331d292f14 /net | |
parent | f1170fd462c67c4ae2f20734566d94e0f8f62f69 (diff) | |
download | linux-0f524a80ff35af8a7664d7661d948107da142e04.tar.bz2 |
net: Add warning if any lower device is still in adjacency list
Lower list should be empty just like upper.
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index a9fe14908b44..c6bbf310d407 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5219,6 +5219,20 @@ struct net_device *netdev_master_upper_dev_get(struct net_device *dev) } EXPORT_SYMBOL(netdev_master_upper_dev_get); +/** + * netdev_has_any_lower_dev - Check if device is linked to some device + * @dev: device + * + * Find out if a device is linked to a lower device and return true in case + * it is. The caller must hold the RTNL lock. + */ +static bool netdev_has_any_lower_dev(struct net_device *dev) +{ + ASSERT_RTNL(); + + return !list_empty(&dev->adj_list.lower); +} + void *netdev_adjacent_get_private(struct list_head *adj_list) { struct netdev_adjacent *adj; @@ -6616,6 +6630,7 @@ static void rollback_registered_many(struct list_head *head) /* Notifier chain MUST detach us all upper devices. */ WARN_ON(netdev_has_any_upper_dev(dev)); + WARN_ON(netdev_has_any_lower_dev(dev)); /* Remove entries from kobject tree */ netdev_unregister_kobject(dev); |