diff options
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r-- | net/core/rtnetlink.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 24431e578310..448703312fed 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -324,6 +324,10 @@ void rtnl_unregister_all(int protocol) | |||
324 | 324 | ||
325 | rtnl_lock(); | 325 | rtnl_lock(); |
326 | tab = rtnl_msg_handlers[protocol]; | 326 | tab = rtnl_msg_handlers[protocol]; |
327 | if (!tab) { | ||
328 | rtnl_unlock(); | ||
329 | return; | ||
330 | } | ||
327 | RCU_INIT_POINTER(rtnl_msg_handlers[protocol], NULL); | 331 | RCU_INIT_POINTER(rtnl_msg_handlers[protocol], NULL); |
328 | for (msgindex = 0; msgindex < RTM_NR_MSGTYPES; msgindex++) { | 332 | for (msgindex = 0; msgindex < RTM_NR_MSGTYPES; msgindex++) { |
329 | link = tab[msgindex]; | 333 | link = tab[msgindex]; |
@@ -1894,10 +1898,8 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | |||
1894 | if (tb[IFLA_IF_NETNSID]) { | 1898 | if (tb[IFLA_IF_NETNSID]) { |
1895 | netnsid = nla_get_s32(tb[IFLA_IF_NETNSID]); | 1899 | netnsid = nla_get_s32(tb[IFLA_IF_NETNSID]); |
1896 | tgt_net = get_target_net(skb->sk, netnsid); | 1900 | tgt_net = get_target_net(skb->sk, netnsid); |
1897 | if (IS_ERR(tgt_net)) { | 1901 | if (IS_ERR(tgt_net)) |
1898 | tgt_net = net; | 1902 | return PTR_ERR(tgt_net); |
1899 | netnsid = -1; | ||
1900 | } | ||
1901 | } | 1903 | } |
1902 | 1904 | ||
1903 | if (tb[IFLA_EXT_MASK]) | 1905 | if (tb[IFLA_EXT_MASK]) |
@@ -2806,7 +2808,7 @@ int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm) | |||
2806 | } | 2808 | } |
2807 | 2809 | ||
2808 | if (dev->rtnl_link_state == RTNL_LINK_INITIALIZED) { | 2810 | if (dev->rtnl_link_state == RTNL_LINK_INITIALIZED) { |
2809 | __dev_notify_flags(dev, old_flags, 0U); | 2811 | __dev_notify_flags(dev, old_flags, (old_flags ^ dev->flags)); |
2810 | } else { | 2812 | } else { |
2811 | dev->rtnl_link_state = RTNL_LINK_INITIALIZED; | 2813 | dev->rtnl_link_state = RTNL_LINK_INITIALIZED; |
2812 | __dev_notify_flags(dev, old_flags, ~0U); | 2814 | __dev_notify_flags(dev, old_flags, ~0U); |
@@ -2833,6 +2835,12 @@ struct net_device *rtnl_create_link(struct net *net, | |||
2833 | else if (ops->get_num_rx_queues) | 2835 | else if (ops->get_num_rx_queues) |
2834 | num_rx_queues = ops->get_num_rx_queues(); | 2836 | num_rx_queues = ops->get_num_rx_queues(); |
2835 | 2837 | ||
2838 | if (num_tx_queues < 1 || num_tx_queues > 4096) | ||
2839 | return ERR_PTR(-EINVAL); | ||
2840 | |||
2841 | if (num_rx_queues < 1 || num_rx_queues > 4096) | ||
2842 | return ERR_PTR(-EINVAL); | ||
2843 | |||
2836 | dev = alloc_netdev_mqs(ops->priv_size, ifname, name_assign_type, | 2844 | dev = alloc_netdev_mqs(ops->priv_size, ifname, name_assign_type, |
2837 | ops->setup, num_tx_queues, num_rx_queues); | 2845 | ops->setup, num_tx_queues, num_rx_queues); |
2838 | if (!dev) | 2846 | if (!dev) |