diff options
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index e13807b5c84d..eca5458b2753 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1629,6 +1629,7 @@ int register_netdevice_notifier(struct notifier_block *nb) | |||
1629 | goto unlock; | 1629 | goto unlock; |
1630 | if (dev_boot_phase) | 1630 | if (dev_boot_phase) |
1631 | goto unlock; | 1631 | goto unlock; |
1632 | down_read(&net_rwsem); | ||
1632 | for_each_net(net) { | 1633 | for_each_net(net) { |
1633 | for_each_netdev(net, dev) { | 1634 | for_each_netdev(net, dev) { |
1634 | err = call_netdevice_notifier(nb, NETDEV_REGISTER, dev); | 1635 | err = call_netdevice_notifier(nb, NETDEV_REGISTER, dev); |
@@ -1642,6 +1643,7 @@ int register_netdevice_notifier(struct notifier_block *nb) | |||
1642 | call_netdevice_notifier(nb, NETDEV_UP, dev); | 1643 | call_netdevice_notifier(nb, NETDEV_UP, dev); |
1643 | } | 1644 | } |
1644 | } | 1645 | } |
1646 | up_read(&net_rwsem); | ||
1645 | 1647 | ||
1646 | unlock: | 1648 | unlock: |
1647 | rtnl_unlock(); | 1649 | rtnl_unlock(); |
@@ -1664,6 +1666,7 @@ rollback: | |||
1664 | } | 1666 | } |
1665 | 1667 | ||
1666 | outroll: | 1668 | outroll: |
1669 | up_read(&net_rwsem); | ||
1667 | raw_notifier_chain_unregister(&netdev_chain, nb); | 1670 | raw_notifier_chain_unregister(&netdev_chain, nb); |
1668 | goto unlock; | 1671 | goto unlock; |
1669 | } | 1672 | } |
@@ -1694,6 +1697,7 @@ int unregister_netdevice_notifier(struct notifier_block *nb) | |||
1694 | if (err) | 1697 | if (err) |
1695 | goto unlock; | 1698 | goto unlock; |
1696 | 1699 | ||
1700 | down_read(&net_rwsem); | ||
1697 | for_each_net(net) { | 1701 | for_each_net(net) { |
1698 | for_each_netdev(net, dev) { | 1702 | for_each_netdev(net, dev) { |
1699 | if (dev->flags & IFF_UP) { | 1703 | if (dev->flags & IFF_UP) { |
@@ -1704,6 +1708,7 @@ int unregister_netdevice_notifier(struct notifier_block *nb) | |||
1704 | call_netdevice_notifier(nb, NETDEV_UNREGISTER, dev); | 1708 | call_netdevice_notifier(nb, NETDEV_UNREGISTER, dev); |
1705 | } | 1709 | } |
1706 | } | 1710 | } |
1711 | up_read(&net_rwsem); | ||
1707 | unlock: | 1712 | unlock: |
1708 | rtnl_unlock(); | 1713 | rtnl_unlock(); |
1709 | return err; | 1714 | return err; |