diff options
author | Dave Airlie <airlied@redhat.com> | 2017-06-26 17:24:49 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2017-06-26 18:28:30 -0400 |
commit | 6d61e70ccc21606ffb8a0a03bd3aba24f659502b (patch) | |
tree | 69f5bfb29d085cc42839445d34170bd3ee4f7408 /net | |
parent | 338ffbf7cb5eee0ed4600650d03cd2d7cd1cac9d (diff) | |
parent | c0bc126f97fb929b3ae02c1c62322645d70eb408 (diff) |
Backmerge tag 'v4.12-rc7' into drm-next
Linux 4.12-rc7
Needed at least rc6 for drm-misc-next-fixes, may as well go to rc7
Diffstat (limited to 'net')
59 files changed, 319 insertions, 248 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 467069b73ce1..9649579b5b9f 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -277,7 +277,8 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id) | |||
277 | return 0; | 277 | return 0; |
278 | 278 | ||
279 | out_free_newdev: | 279 | out_free_newdev: |
280 | free_netdev(new_dev); | 280 | if (new_dev->reg_state == NETREG_UNINITIALIZED) |
281 | free_netdev(new_dev); | ||
281 | return err; | 282 | return err; |
282 | } | 283 | } |
283 | 284 | ||
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 953b6728bd00..abc5f400fc71 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -813,7 +813,6 @@ static void vlan_dev_free(struct net_device *dev) | |||
813 | 813 | ||
814 | free_percpu(vlan->vlan_pcpu_stats); | 814 | free_percpu(vlan->vlan_pcpu_stats); |
815 | vlan->vlan_pcpu_stats = NULL; | 815 | vlan->vlan_pcpu_stats = NULL; |
816 | free_netdev(dev); | ||
817 | } | 816 | } |
818 | 817 | ||
819 | void vlan_setup(struct net_device *dev) | 818 | void vlan_setup(struct net_device *dev) |
@@ -826,7 +825,8 @@ void vlan_setup(struct net_device *dev) | |||
826 | netif_keep_dst(dev); | 825 | netif_keep_dst(dev); |
827 | 826 | ||
828 | dev->netdev_ops = &vlan_netdev_ops; | 827 | dev->netdev_ops = &vlan_netdev_ops; |
829 | dev->destructor = vlan_dev_free; | 828 | dev->needs_free_netdev = true; |
829 | dev->priv_destructor = vlan_dev_free; | ||
830 | dev->ethtool_ops = &vlan_ethtool_ops; | 830 | dev->ethtool_ops = &vlan_ethtool_ops; |
831 | 831 | ||
832 | dev->min_mtu = 0; | 832 | dev->min_mtu = 0; |
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index 013e970eff39..000ca2f113ab 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c | |||
@@ -1064,8 +1064,9 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, | |||
1064 | 1064 | ||
1065 | skb_new->protocol = eth_type_trans(skb_new, soft_iface); | 1065 | skb_new->protocol = eth_type_trans(skb_new, soft_iface); |
1066 | 1066 | ||
1067 | soft_iface->stats.rx_packets++; | 1067 | batadv_inc_counter(bat_priv, BATADV_CNT_RX); |
1068 | soft_iface->stats.rx_bytes += skb->len + ETH_HLEN + hdr_size; | 1068 | batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES, |
1069 | skb->len + ETH_HLEN + hdr_size); | ||
1069 | 1070 | ||
1070 | netif_rx(skb_new); | 1071 | netif_rx(skb_new); |
1071 | batadv_dbg(BATADV_DBG_DAT, bat_priv, "ARP request replied locally\n"); | 1072 | batadv_dbg(BATADV_DBG_DAT, bat_priv, "ARP request replied locally\n"); |
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index e1ebe14ee2a6..ae9f4d37d34f 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -987,7 +987,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, | |||
987 | batadv_dbg(BATADV_DBG_BLA, bat_priv, | 987 | batadv_dbg(BATADV_DBG_BLA, bat_priv, |
988 | "recv_unicast_packet(): Dropped unicast pkt received from another backbone gw %pM.\n", | 988 | "recv_unicast_packet(): Dropped unicast pkt received from another backbone gw %pM.\n", |
989 | orig_addr_gw); | 989 | orig_addr_gw); |
990 | return NET_RX_DROP; | 990 | goto free_skb; |
991 | } | 991 | } |
992 | } | 992 | } |
993 | 993 | ||
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index b25789abf7b9..10f7edfb176e 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -1034,8 +1034,6 @@ static void batadv_softif_free(struct net_device *dev) | |||
1034 | * netdev and its private data (bat_priv) | 1034 | * netdev and its private data (bat_priv) |
1035 | */ | 1035 | */ |
1036 | rcu_barrier(); | 1036 | rcu_barrier(); |
1037 | |||
1038 | free_netdev(dev); | ||
1039 | } | 1037 | } |
1040 | 1038 | ||
1041 | /** | 1039 | /** |
@@ -1047,7 +1045,8 @@ static void batadv_softif_init_early(struct net_device *dev) | |||
1047 | ether_setup(dev); | 1045 | ether_setup(dev); |
1048 | 1046 | ||
1049 | dev->netdev_ops = &batadv_netdev_ops; | 1047 | dev->netdev_ops = &batadv_netdev_ops; |
1050 | dev->destructor = batadv_softif_free; | 1048 | dev->needs_free_netdev = true; |
1049 | dev->priv_destructor = batadv_softif_free; | ||
1051 | dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_NETNS_LOCAL; | 1050 | dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_NETNS_LOCAL; |
1052 | dev->priv_flags |= IFF_NO_QUEUE; | 1051 | dev->priv_flags |= IFF_NO_QUEUE; |
1053 | 1052 | ||
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index 608959989f8e..ab3b654b05cc 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c | |||
@@ -598,7 +598,7 @@ static void netdev_setup(struct net_device *dev) | |||
598 | 598 | ||
599 | dev->netdev_ops = &netdev_ops; | 599 | dev->netdev_ops = &netdev_ops; |
600 | dev->header_ops = &header_ops; | 600 | dev->header_ops = &header_ops; |
601 | dev->destructor = free_netdev; | 601 | dev->needs_free_netdev = true; |
602 | } | 602 | } |
603 | 603 | ||
604 | static struct device_type bt_type = { | 604 | static struct device_type bt_type = { |
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 430b53e7d941..f0f3447e8aa4 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c | |||
@@ -379,7 +379,7 @@ void br_dev_setup(struct net_device *dev) | |||
379 | ether_setup(dev); | 379 | ether_setup(dev); |
380 | 380 | ||
381 | dev->netdev_ops = &br_netdev_ops; | 381 | dev->netdev_ops = &br_netdev_ops; |
382 | dev->destructor = free_netdev; | 382 | dev->needs_free_netdev = true; |
383 | dev->ethtool_ops = &br_ethtool_ops; | 383 | dev->ethtool_ops = &br_ethtool_ops; |
384 | SET_NETDEV_DEVTYPE(dev, &br_type); | 384 | SET_NETDEV_DEVTYPE(dev, &br_type); |
385 | dev->priv_flags = IFF_EBRIDGE | IFF_NO_QUEUE; | 385 | dev->priv_flags = IFF_EBRIDGE | IFF_NO_QUEUE; |
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c index adcad344c843..21f18ea2fce4 100644 --- a/net/caif/caif_socket.c +++ b/net/caif/caif_socket.c | |||
@@ -754,6 +754,10 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr, | |||
754 | 754 | ||
755 | lock_sock(sk); | 755 | lock_sock(sk); |
756 | 756 | ||
757 | err = -EINVAL; | ||
758 | if (addr_len < offsetofend(struct sockaddr, sa_family)) | ||
759 | goto out; | ||
760 | |||
757 | err = -EAFNOSUPPORT; | 761 | err = -EAFNOSUPPORT; |
758 | if (uaddr->sa_family != AF_CAIF) | 762 | if (uaddr->sa_family != AF_CAIF) |
759 | goto out; | 763 | goto out; |
diff --git a/net/caif/cfpkt_skbuff.c b/net/caif/cfpkt_skbuff.c index 59ce1fcc220c..71b6ab240dea 100644 --- a/net/caif/cfpkt_skbuff.c +++ b/net/caif/cfpkt_skbuff.c | |||
@@ -81,11 +81,7 @@ static struct cfpkt *cfpkt_create_pfx(u16 len, u16 pfx) | |||
81 | { | 81 | { |
82 | struct sk_buff *skb; | 82 | struct sk_buff *skb; |
83 | 83 | ||
84 | if (likely(in_interrupt())) | 84 | skb = alloc_skb(len + pfx, GFP_ATOMIC); |
85 | skb = alloc_skb(len + pfx, GFP_ATOMIC); | ||
86 | else | ||
87 | skb = alloc_skb(len + pfx, GFP_KERNEL); | ||
88 | |||
89 | if (unlikely(skb == NULL)) | 85 | if (unlikely(skb == NULL)) |
90 | return NULL; | 86 | return NULL; |
91 | 87 | ||
diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c index 1816fc9f1ee7..fe3c53efb949 100644 --- a/net/caif/chnl_net.c +++ b/net/caif/chnl_net.c | |||
@@ -392,14 +392,14 @@ static void chnl_net_destructor(struct net_device *dev) | |||
392 | { | 392 | { |
393 | struct chnl_net *priv = netdev_priv(dev); | 393 | struct chnl_net *priv = netdev_priv(dev); |
394 | caif_free_client(&priv->chnl); | 394 | caif_free_client(&priv->chnl); |
395 | free_netdev(dev); | ||
396 | } | 395 | } |
397 | 396 | ||
398 | static void ipcaif_net_setup(struct net_device *dev) | 397 | static void ipcaif_net_setup(struct net_device *dev) |
399 | { | 398 | { |
400 | struct chnl_net *priv; | 399 | struct chnl_net *priv; |
401 | dev->netdev_ops = &netdev_ops; | 400 | dev->netdev_ops = &netdev_ops; |
402 | dev->destructor = chnl_net_destructor; | 401 | dev->needs_free_netdev = true; |
402 | dev->priv_destructor = chnl_net_destructor; | ||
403 | dev->flags |= IFF_NOARP; | 403 | dev->flags |= IFF_NOARP; |
404 | dev->flags |= IFF_POINTOPOINT; | 404 | dev->flags |= IFF_POINTOPOINT; |
405 | dev->mtu = GPRS_PDP_MTU; | 405 | dev->mtu = GPRS_PDP_MTU; |
diff --git a/net/can/af_can.c b/net/can/af_can.c index b6406fe33c76..88edac0f3e36 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
@@ -872,8 +872,7 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg, | |||
872 | 872 | ||
873 | static int can_pernet_init(struct net *net) | 873 | static int can_pernet_init(struct net *net) |
874 | { | 874 | { |
875 | net->can.can_rcvlists_lock = | 875 | spin_lock_init(&net->can.can_rcvlists_lock); |
876 | __SPIN_LOCK_UNLOCKED(net->can.can_rcvlists_lock); | ||
877 | net->can.can_rx_alldev_list = | 876 | net->can.can_rx_alldev_list = |
878 | kzalloc(sizeof(struct dev_rcv_lists), GFP_KERNEL); | 877 | kzalloc(sizeof(struct dev_rcv_lists), GFP_KERNEL); |
879 | 878 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index fca407b4a6ea..7243421c9783 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1253,8 +1253,9 @@ int dev_set_alias(struct net_device *dev, const char *alias, size_t len) | |||
1253 | if (!new_ifalias) | 1253 | if (!new_ifalias) |
1254 | return -ENOMEM; | 1254 | return -ENOMEM; |
1255 | dev->ifalias = new_ifalias; | 1255 | dev->ifalias = new_ifalias; |
1256 | memcpy(dev->ifalias, alias, len); | ||
1257 | dev->ifalias[len] = 0; | ||
1256 | 1258 | ||
1257 | strlcpy(dev->ifalias, alias, len+1); | ||
1258 | return len; | 1259 | return len; |
1259 | } | 1260 | } |
1260 | 1261 | ||
@@ -4948,6 +4949,19 @@ __sum16 __skb_gro_checksum_complete(struct sk_buff *skb) | |||
4948 | } | 4949 | } |
4949 | EXPORT_SYMBOL(__skb_gro_checksum_complete); | 4950 | EXPORT_SYMBOL(__skb_gro_checksum_complete); |
4950 | 4951 | ||
4952 | static void net_rps_send_ipi(struct softnet_data *remsd) | ||
4953 | { | ||
4954 | #ifdef CONFIG_RPS | ||
4955 | while (remsd) { | ||
4956 | struct softnet_data *next = remsd->rps_ipi_next; | ||
4957 | |||
4958 | if (cpu_online(remsd->cpu)) | ||
4959 | smp_call_function_single_async(remsd->cpu, &remsd->csd); | ||
4960 | remsd = next; | ||
4961 | } | ||
4962 | #endif | ||
4963 | } | ||
4964 | |||
4951 | /* | 4965 | /* |
4952 | * net_rps_action_and_irq_enable sends any pending IPI's for rps. | 4966 | * net_rps_action_and_irq_enable sends any pending IPI's for rps. |
4953 | * Note: called with local irq disabled, but exits with local irq enabled. | 4967 | * Note: called with local irq disabled, but exits with local irq enabled. |
@@ -4963,14 +4977,7 @@ static void net_rps_action_and_irq_enable(struct softnet_data *sd) | |||
4963 | local_irq_enable(); | 4977 | local_irq_enable(); |
4964 | 4978 | ||
4965 | /* Send pending IPI's to kick RPS processing on remote cpus. */ | 4979 | /* Send pending IPI's to kick RPS processing on remote cpus. */ |
4966 | while (remsd) { | 4980 | net_rps_send_ipi(remsd); |
4967 | struct softnet_data *next = remsd->rps_ipi_next; | ||
4968 | |||
4969 | if (cpu_online(remsd->cpu)) | ||
4970 | smp_call_function_single_async(remsd->cpu, | ||
4971 | &remsd->csd); | ||
4972 | remsd = next; | ||
4973 | } | ||
4974 | } else | 4981 | } else |
4975 | #endif | 4982 | #endif |
4976 | local_irq_enable(); | 4983 | local_irq_enable(); |
@@ -5199,8 +5206,6 @@ static void busy_poll_stop(struct napi_struct *napi, void *have_poll_lock) | |||
5199 | if (rc == BUSY_POLL_BUDGET) | 5206 | if (rc == BUSY_POLL_BUDGET) |
5200 | __napi_schedule(napi); | 5207 | __napi_schedule(napi); |
5201 | local_bh_enable(); | 5208 | local_bh_enable(); |
5202 | if (local_softirq_pending()) | ||
5203 | do_softirq(); | ||
5204 | } | 5209 | } |
5205 | 5210 | ||
5206 | void napi_busy_loop(unsigned int napi_id, | 5211 | void napi_busy_loop(unsigned int napi_id, |
@@ -7501,6 +7506,8 @@ out: | |||
7501 | err_uninit: | 7506 | err_uninit: |
7502 | if (dev->netdev_ops->ndo_uninit) | 7507 | if (dev->netdev_ops->ndo_uninit) |
7503 | dev->netdev_ops->ndo_uninit(dev); | 7508 | dev->netdev_ops->ndo_uninit(dev); |
7509 | if (dev->priv_destructor) | ||
7510 | dev->priv_destructor(dev); | ||
7504 | goto out; | 7511 | goto out; |
7505 | } | 7512 | } |
7506 | EXPORT_SYMBOL(register_netdevice); | 7513 | EXPORT_SYMBOL(register_netdevice); |
@@ -7708,8 +7715,10 @@ void netdev_run_todo(void) | |||
7708 | WARN_ON(rcu_access_pointer(dev->ip6_ptr)); | 7715 | WARN_ON(rcu_access_pointer(dev->ip6_ptr)); |
7709 | WARN_ON(dev->dn_ptr); | 7716 | WARN_ON(dev->dn_ptr); |
7710 | 7717 | ||
7711 | if (dev->destructor) | 7718 | if (dev->priv_destructor) |
7712 | dev->destructor(dev); | 7719 | dev->priv_destructor(dev); |
7720 | if (dev->needs_free_netdev) | ||
7721 | free_netdev(dev); | ||
7713 | 7722 | ||
7714 | /* Report a network device has been unregistered */ | 7723 | /* Report a network device has been unregistered */ |
7715 | rtnl_lock(); | 7724 | rtnl_lock(); |
@@ -8192,7 +8201,7 @@ static int dev_cpu_dead(unsigned int oldcpu) | |||
8192 | struct sk_buff **list_skb; | 8201 | struct sk_buff **list_skb; |
8193 | struct sk_buff *skb; | 8202 | struct sk_buff *skb; |
8194 | unsigned int cpu; | 8203 | unsigned int cpu; |
8195 | struct softnet_data *sd, *oldsd; | 8204 | struct softnet_data *sd, *oldsd, *remsd = NULL; |
8196 | 8205 | ||
8197 | local_irq_disable(); | 8206 | local_irq_disable(); |
8198 | cpu = smp_processor_id(); | 8207 | cpu = smp_processor_id(); |
@@ -8233,6 +8242,13 @@ static int dev_cpu_dead(unsigned int oldcpu) | |||
8233 | raise_softirq_irqoff(NET_TX_SOFTIRQ); | 8242 | raise_softirq_irqoff(NET_TX_SOFTIRQ); |
8234 | local_irq_enable(); | 8243 | local_irq_enable(); |
8235 | 8244 | ||
8245 | #ifdef CONFIG_RPS | ||
8246 | remsd = oldsd->rps_ipi_list; | ||
8247 | oldsd->rps_ipi_list = NULL; | ||
8248 | #endif | ||
8249 | /* send out pending IPI's on offline CPU */ | ||
8250 | net_rps_send_ipi(remsd); | ||
8251 | |||
8236 | /* Process offline CPU's input_pkt_queue */ | 8252 | /* Process offline CPU's input_pkt_queue */ |
8237 | while ((skb = __skb_dequeue(&oldsd->process_queue))) { | 8253 | while ((skb = __skb_dequeue(&oldsd->process_queue))) { |
8238 | netif_rx_ni(skb); | 8254 | netif_rx_ni(skb); |
diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c index b94b1d293506..27fad31784a8 100644 --- a/net/core/dev_ioctl.c +++ b/net/core/dev_ioctl.c | |||
@@ -410,6 +410,22 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
410 | if (cmd == SIOCGIFNAME) | 410 | if (cmd == SIOCGIFNAME) |
411 | return dev_ifname(net, (struct ifreq __user *)arg); | 411 | return dev_ifname(net, (struct ifreq __user *)arg); |
412 | 412 | ||
413 | /* | ||
414 | * Take care of Wireless Extensions. Unfortunately struct iwreq | ||
415 | * isn't a proper subset of struct ifreq (it's 8 byte shorter) | ||
416 | * so we need to treat it specially, otherwise applications may | ||
417 | * fault if the struct they're passing happens to land at the | ||
418 | * end of a mapped page. | ||
419 | */ | ||
420 | if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) { | ||
421 | struct iwreq iwr; | ||
422 | |||
423 | if (copy_from_user(&iwr, arg, sizeof(iwr))) | ||
424 | return -EFAULT; | ||
425 | |||
426 | return wext_handle_ioctl(net, &iwr, cmd, arg); | ||
427 | } | ||
428 | |||
413 | if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) | 429 | if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) |
414 | return -EFAULT; | 430 | return -EFAULT; |
415 | 431 | ||
@@ -559,9 +575,6 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
559 | ret = -EFAULT; | 575 | ret = -EFAULT; |
560 | return ret; | 576 | return ret; |
561 | } | 577 | } |
562 | /* Take care of Wireless Extensions */ | ||
563 | if (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) | ||
564 | return wext_handle_ioctl(net, &ifr, cmd, arg); | ||
565 | return -ENOTTY; | 578 | return -ENOTTY; |
566 | } | 579 | } |
567 | } | 580 | } |
diff --git a/net/core/dst.c b/net/core/dst.c index 6192f11beec9..13ba4a090c41 100644 --- a/net/core/dst.c +++ b/net/core/dst.c | |||
@@ -469,6 +469,20 @@ static int dst_dev_event(struct notifier_block *this, unsigned long event, | |||
469 | spin_lock_bh(&dst_garbage.lock); | 469 | spin_lock_bh(&dst_garbage.lock); |
470 | dst = dst_garbage.list; | 470 | dst = dst_garbage.list; |
471 | dst_garbage.list = NULL; | 471 | dst_garbage.list = NULL; |
472 | /* The code in dst_ifdown places a hold on the loopback device. | ||
473 | * If the gc entry processing is set to expire after a lengthy | ||
474 | * interval, this hold can cause netdev_wait_allrefs() to hang | ||
475 | * out and wait for a long time -- until the the loopback | ||
476 | * interface is released. If we're really unlucky, it'll emit | ||
477 | * pr_emerg messages to console too. Reset the interval here, | ||
478 | * so dst cleanups occur in a more timely fashion. | ||
479 | */ | ||
480 | if (dst_garbage.timer_inc > DST_GC_INC) { | ||
481 | dst_garbage.timer_inc = DST_GC_INC; | ||
482 | dst_garbage.timer_expires = DST_GC_MIN; | ||
483 | mod_delayed_work(system_wq, &dst_gc_work, | ||
484 | dst_garbage.timer_expires); | ||
485 | } | ||
472 | spin_unlock_bh(&dst_garbage.lock); | 486 | spin_unlock_bh(&dst_garbage.lock); |
473 | 487 | ||
474 | if (last) | 488 | if (last) |
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index f21c4d3aeae0..3bba291c6c32 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -568,7 +568,7 @@ int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
568 | struct net *net = sock_net(skb->sk); | 568 | struct net *net = sock_net(skb->sk); |
569 | struct fib_rule_hdr *frh = nlmsg_data(nlh); | 569 | struct fib_rule_hdr *frh = nlmsg_data(nlh); |
570 | struct fib_rules_ops *ops = NULL; | 570 | struct fib_rules_ops *ops = NULL; |
571 | struct fib_rule *rule, *tmp; | 571 | struct fib_rule *rule, *r; |
572 | struct nlattr *tb[FRA_MAX+1]; | 572 | struct nlattr *tb[FRA_MAX+1]; |
573 | struct fib_kuid_range range; | 573 | struct fib_kuid_range range; |
574 | int err = -EINVAL; | 574 | int err = -EINVAL; |
@@ -668,16 +668,23 @@ int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
668 | 668 | ||
669 | /* | 669 | /* |
670 | * Check if this rule is a target to any of them. If so, | 670 | * Check if this rule is a target to any of them. If so, |
671 | * adjust to the next one with the same preference or | ||
671 | * disable them. As this operation is eventually very | 672 | * disable them. As this operation is eventually very |
672 | * expensive, it is only performed if goto rules have | 673 | * expensive, it is only performed if goto rules, except |
673 | * actually been added. | 674 | * current if it is goto rule, have actually been added. |
674 | */ | 675 | */ |
675 | if (ops->nr_goto_rules > 0) { | 676 | if (ops->nr_goto_rules > 0) { |
676 | list_for_each_entry(tmp, &ops->rules_list, list) { | 677 | struct fib_rule *n; |
677 | if (rtnl_dereference(tmp->ctarget) == rule) { | 678 | |
678 | RCU_INIT_POINTER(tmp->ctarget, NULL); | 679 | n = list_next_entry(rule, list); |
680 | if (&n->list == &ops->rules_list || n->pref != rule->pref) | ||
681 | n = NULL; | ||
682 | list_for_each_entry(r, &ops->rules_list, list) { | ||
683 | if (rtnl_dereference(r->ctarget) != rule) | ||
684 | continue; | ||
685 | rcu_assign_pointer(r->ctarget, n); | ||
686 | if (!n) | ||
679 | ops->unresolved_rules++; | 687 | ops->unresolved_rules++; |
680 | } | ||
681 | } | 688 | } |
682 | } | 689 | } |
683 | 690 | ||
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 9e2c0a7cb325..467a2f4510a7 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -931,6 +931,7 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev, | |||
931 | + nla_total_size(1) /* IFLA_LINKMODE */ | 931 | + nla_total_size(1) /* IFLA_LINKMODE */ |
932 | + nla_total_size(4) /* IFLA_CARRIER_CHANGES */ | 932 | + nla_total_size(4) /* IFLA_CARRIER_CHANGES */ |
933 | + nla_total_size(4) /* IFLA_LINK_NETNSID */ | 933 | + nla_total_size(4) /* IFLA_LINK_NETNSID */ |
934 | + nla_total_size(4) /* IFLA_GROUP */ | ||
934 | + nla_total_size(ext_filter_mask | 935 | + nla_total_size(ext_filter_mask |
935 | & RTEXT_FILTER_VF ? 4 : 0) /* IFLA_NUM_VF */ | 936 | & RTEXT_FILTER_VF ? 4 : 0) /* IFLA_NUM_VF */ |
936 | + rtnl_vfinfo_size(dev, ext_filter_mask) /* IFLA_VFINFO_LIST */ | 937 | + rtnl_vfinfo_size(dev, ext_filter_mask) /* IFLA_VFINFO_LIST */ |
@@ -1124,6 +1125,8 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, | |||
1124 | struct ifla_vf_mac vf_mac; | 1125 | struct ifla_vf_mac vf_mac; |
1125 | struct ifla_vf_info ivi; | 1126 | struct ifla_vf_info ivi; |
1126 | 1127 | ||
1128 | memset(&ivi, 0, sizeof(ivi)); | ||
1129 | |||
1127 | /* Not all SR-IOV capable drivers support the | 1130 | /* Not all SR-IOV capable drivers support the |
1128 | * spoofcheck and "RSS query enable" query. Preset to | 1131 | * spoofcheck and "RSS query enable" query. Preset to |
1129 | * -1 so the user space tool can detect that the driver | 1132 | * -1 so the user space tool can detect that the driver |
@@ -1132,7 +1135,6 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, | |||
1132 | ivi.spoofchk = -1; | 1135 | ivi.spoofchk = -1; |
1133 | ivi.rss_query_en = -1; | 1136 | ivi.rss_query_en = -1; |
1134 | ivi.trusted = -1; | 1137 | ivi.trusted = -1; |
1135 | memset(ivi.mac, 0, sizeof(ivi.mac)); | ||
1136 | /* The default value for VF link state is "auto" | 1138 | /* The default value for VF link state is "auto" |
1137 | * IFLA_VF_LINK_STATE_AUTO which equals zero | 1139 | * IFLA_VF_LINK_STATE_AUTO which equals zero |
1138 | */ | 1140 | */ |
@@ -1467,6 +1469,7 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = { | |||
1467 | [IFLA_LINK_NETNSID] = { .type = NLA_S32 }, | 1469 | [IFLA_LINK_NETNSID] = { .type = NLA_S32 }, |
1468 | [IFLA_PROTO_DOWN] = { .type = NLA_U8 }, | 1470 | [IFLA_PROTO_DOWN] = { .type = NLA_U8 }, |
1469 | [IFLA_XDP] = { .type = NLA_NESTED }, | 1471 | [IFLA_XDP] = { .type = NLA_NESTED }, |
1472 | [IFLA_GROUP] = { .type = NLA_U32 }, | ||
1470 | }; | 1473 | }; |
1471 | 1474 | ||
1472 | static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { | 1475 | static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = { |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 4b9518a0d248..6f95612b4d32 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -188,12 +188,6 @@ static inline void dnrt_free(struct dn_route *rt) | |||
188 | call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free); | 188 | call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free); |
189 | } | 189 | } |
190 | 190 | ||
191 | static inline void dnrt_drop(struct dn_route *rt) | ||
192 | { | ||
193 | dst_release(&rt->dst); | ||
194 | call_rcu_bh(&rt->dst.rcu_head, dst_rcu_free); | ||
195 | } | ||
196 | |||
197 | static void dn_dst_check_expire(unsigned long dummy) | 191 | static void dn_dst_check_expire(unsigned long dummy) |
198 | { | 192 | { |
199 | int i; | 193 | int i; |
@@ -248,7 +242,7 @@ static int dn_dst_gc(struct dst_ops *ops) | |||
248 | } | 242 | } |
249 | *rtp = rt->dst.dn_next; | 243 | *rtp = rt->dst.dn_next; |
250 | rt->dst.dn_next = NULL; | 244 | rt->dst.dn_next = NULL; |
251 | dnrt_drop(rt); | 245 | dnrt_free(rt); |
252 | break; | 246 | break; |
253 | } | 247 | } |
254 | spin_unlock_bh(&dn_rt_hash_table[i].lock); | 248 | spin_unlock_bh(&dn_rt_hash_table[i].lock); |
@@ -350,7 +344,7 @@ static int dn_insert_route(struct dn_route *rt, unsigned int hash, struct dn_rou | |||
350 | dst_use(&rth->dst, now); | 344 | dst_use(&rth->dst, now); |
351 | spin_unlock_bh(&dn_rt_hash_table[hash].lock); | 345 | spin_unlock_bh(&dn_rt_hash_table[hash].lock); |
352 | 346 | ||
353 | dnrt_drop(rt); | 347 | dst_free(&rt->dst); |
354 | *rp = rth; | 348 | *rp = rth; |
355 | return 0; | 349 | return 0; |
356 | } | 350 | } |
@@ -380,7 +374,7 @@ static void dn_run_flush(unsigned long dummy) | |||
380 | for(; rt; rt = next) { | 374 | for(; rt; rt = next) { |
381 | next = rcu_dereference_raw(rt->dst.dn_next); | 375 | next = rcu_dereference_raw(rt->dst.dn_next); |
382 | RCU_INIT_POINTER(rt->dst.dn_next, NULL); | 376 | RCU_INIT_POINTER(rt->dst.dn_next, NULL); |
383 | dst_free((struct dst_entry *)rt); | 377 | dnrt_free(rt); |
384 | } | 378 | } |
385 | 379 | ||
386 | nothing_to_declare: | 380 | nothing_to_declare: |
@@ -1187,7 +1181,7 @@ make_route: | |||
1187 | if (dev_out->flags & IFF_LOOPBACK) | 1181 | if (dev_out->flags & IFF_LOOPBACK) |
1188 | flags |= RTCF_LOCAL; | 1182 | flags |= RTCF_LOCAL; |
1189 | 1183 | ||
1190 | rt = dst_alloc(&dn_dst_ops, dev_out, 1, DST_OBSOLETE_NONE, DST_HOST); | 1184 | rt = dst_alloc(&dn_dst_ops, dev_out, 0, DST_OBSOLETE_NONE, DST_HOST); |
1191 | if (rt == NULL) | 1185 | if (rt == NULL) |
1192 | goto e_nobufs; | 1186 | goto e_nobufs; |
1193 | 1187 | ||
diff --git a/net/decnet/netfilter/dn_rtmsg.c b/net/decnet/netfilter/dn_rtmsg.c index 1ed81ac6dd1a..aa8ffecc46a4 100644 --- a/net/decnet/netfilter/dn_rtmsg.c +++ b/net/decnet/netfilter/dn_rtmsg.c | |||
@@ -102,7 +102,9 @@ static inline void dnrmg_receive_user_skb(struct sk_buff *skb) | |||
102 | { | 102 | { |
103 | struct nlmsghdr *nlh = nlmsg_hdr(skb); | 103 | struct nlmsghdr *nlh = nlmsg_hdr(skb); |
104 | 104 | ||
105 | if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) | 105 | if (skb->len < sizeof(*nlh) || |
106 | nlh->nlmsg_len < sizeof(*nlh) || | ||
107 | skb->len < nlh->nlmsg_len) | ||
106 | return; | 108 | return; |
107 | 109 | ||
108 | if (!netlink_capable(skb, CAP_NET_ADMIN)) | 110 | if (!netlink_capable(skb, CAP_NET_ADMIN)) |
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index c73160fb11e7..0a0a392dc2bd 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c | |||
@@ -378,7 +378,6 @@ static void hsr_dev_destroy(struct net_device *hsr_dev) | |||
378 | del_timer_sync(&hsr->announce_timer); | 378 | del_timer_sync(&hsr->announce_timer); |
379 | 379 | ||
380 | synchronize_rcu(); | 380 | synchronize_rcu(); |
381 | free_netdev(hsr_dev); | ||
382 | } | 381 | } |
383 | 382 | ||
384 | static const struct net_device_ops hsr_device_ops = { | 383 | static const struct net_device_ops hsr_device_ops = { |
@@ -404,7 +403,8 @@ void hsr_dev_setup(struct net_device *dev) | |||
404 | SET_NETDEV_DEVTYPE(dev, &hsr_type); | 403 | SET_NETDEV_DEVTYPE(dev, &hsr_type); |
405 | dev->priv_flags |= IFF_NO_QUEUE; | 404 | dev->priv_flags |= IFF_NO_QUEUE; |
406 | 405 | ||
407 | dev->destructor = hsr_dev_destroy; | 406 | dev->needs_free_netdev = true; |
407 | dev->priv_destructor = hsr_dev_destroy; | ||
408 | 408 | ||
409 | dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | | 409 | dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | |
410 | NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | | 410 | NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | |
diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c index 4ebe2aa3e7d3..04b5450c5a55 100644 --- a/net/hsr/hsr_forward.c +++ b/net/hsr/hsr_forward.c | |||
@@ -324,8 +324,7 @@ static int hsr_fill_frame_info(struct hsr_frame_info *frame, | |||
324 | unsigned long irqflags; | 324 | unsigned long irqflags; |
325 | 325 | ||
326 | frame->is_supervision = is_supervision_frame(port->hsr, skb); | 326 | frame->is_supervision = is_supervision_frame(port->hsr, skb); |
327 | frame->node_src = hsr_get_node(&port->hsr->node_db, skb, | 327 | frame->node_src = hsr_get_node(port, skb, frame->is_supervision); |
328 | frame->is_supervision); | ||
329 | if (frame->node_src == NULL) | 328 | if (frame->node_src == NULL) |
330 | return -1; /* Unknown node and !is_supervision, or no mem */ | 329 | return -1; /* Unknown node and !is_supervision, or no mem */ |
331 | 330 | ||
diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c index 7ea925816f79..284a9b820df8 100644 --- a/net/hsr/hsr_framereg.c +++ b/net/hsr/hsr_framereg.c | |||
@@ -158,9 +158,10 @@ struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[], | |||
158 | 158 | ||
159 | /* Get the hsr_node from which 'skb' was sent. | 159 | /* Get the hsr_node from which 'skb' was sent. |
160 | */ | 160 | */ |
161 | struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb, | 161 | struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb, |
162 | bool is_sup) | 162 | bool is_sup) |
163 | { | 163 | { |
164 | struct list_head *node_db = &port->hsr->node_db; | ||
164 | struct hsr_node *node; | 165 | struct hsr_node *node; |
165 | struct ethhdr *ethhdr; | 166 | struct ethhdr *ethhdr; |
166 | u16 seq_out; | 167 | u16 seq_out; |
@@ -186,7 +187,11 @@ struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb, | |||
186 | */ | 187 | */ |
187 | seq_out = hsr_get_skb_sequence_nr(skb) - 1; | 188 | seq_out = hsr_get_skb_sequence_nr(skb) - 1; |
188 | } else { | 189 | } else { |
189 | WARN_ONCE(1, "%s: Non-HSR frame\n", __func__); | 190 | /* this is called also for frames from master port and |
191 | * so warn only for non master ports | ||
192 | */ | ||
193 | if (port->type != HSR_PT_MASTER) | ||
194 | WARN_ONCE(1, "%s: Non-HSR frame\n", __func__); | ||
190 | seq_out = HSR_SEQNR_START; | 195 | seq_out = HSR_SEQNR_START; |
191 | } | 196 | } |
192 | 197 | ||
diff --git a/net/hsr/hsr_framereg.h b/net/hsr/hsr_framereg.h index 438b40f98f5a..4e04f0e868e9 100644 --- a/net/hsr/hsr_framereg.h +++ b/net/hsr/hsr_framereg.h | |||
@@ -18,7 +18,7 @@ struct hsr_node; | |||
18 | 18 | ||
19 | struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[], | 19 | struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[], |
20 | u16 seq_out); | 20 | u16 seq_out); |
21 | struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb, | 21 | struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb, |
22 | bool is_sup); | 22 | bool is_sup); |
23 | void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr, | 23 | void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr, |
24 | struct hsr_port *port); | 24 | struct hsr_port *port); |
diff --git a/net/ieee802154/6lowpan/core.c b/net/ieee802154/6lowpan/core.c index d7efbf0dad20..0a866f332290 100644 --- a/net/ieee802154/6lowpan/core.c +++ b/net/ieee802154/6lowpan/core.c | |||
@@ -107,7 +107,7 @@ static void lowpan_setup(struct net_device *ldev) | |||
107 | 107 | ||
108 | ldev->netdev_ops = &lowpan_netdev_ops; | 108 | ldev->netdev_ops = &lowpan_netdev_ops; |
109 | ldev->header_ops = &lowpan_header_ops; | 109 | ldev->header_ops = &lowpan_header_ops; |
110 | ldev->destructor = free_netdev; | 110 | ldev->needs_free_netdev = true; |
111 | ldev->features |= NETIF_F_NETNS_LOCAL; | 111 | ldev->features |= NETIF_F_NETNS_LOCAL; |
112 | } | 112 | } |
113 | 113 | ||
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 43318b5f5647..9144fa7df2ad 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -657,8 +657,12 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) | |||
657 | /* Needed by both icmp_global_allow and icmp_xmit_lock */ | 657 | /* Needed by both icmp_global_allow and icmp_xmit_lock */ |
658 | local_bh_disable(); | 658 | local_bh_disable(); |
659 | 659 | ||
660 | /* Check global sysctl_icmp_msgs_per_sec ratelimit */ | 660 | /* Check global sysctl_icmp_msgs_per_sec ratelimit, unless |
661 | if (!icmpv4_global_allow(net, type, code)) | 661 | * incoming dev is loopback. If outgoing dev change to not be |
662 | * loopback, then peer ratelimit still work (in icmpv4_xrlim_allow) | ||
663 | */ | ||
664 | if (!(skb_in->dev && (skb_in->dev->flags&IFF_LOOPBACK)) && | ||
665 | !icmpv4_global_allow(net, type, code)) | ||
662 | goto out_bh_enable; | 666 | goto out_bh_enable; |
663 | 667 | ||
664 | sk = icmp_xmit_lock(net); | 668 | sk = icmp_xmit_lock(net); |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 44fd86de2823..ec9a396fa466 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -1112,6 +1112,7 @@ static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im) | |||
1112 | pmc = kzalloc(sizeof(*pmc), GFP_KERNEL); | 1112 | pmc = kzalloc(sizeof(*pmc), GFP_KERNEL); |
1113 | if (!pmc) | 1113 | if (!pmc) |
1114 | return; | 1114 | return; |
1115 | spin_lock_init(&pmc->lock); | ||
1115 | spin_lock_bh(&im->lock); | 1116 | spin_lock_bh(&im->lock); |
1116 | pmc->interface = im->interface; | 1117 | pmc->interface = im->interface; |
1117 | in_dev_hold(in_dev); | 1118 | in_dev_hold(in_dev); |
@@ -2071,21 +2072,26 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, | |||
2071 | 2072 | ||
2072 | static void ip_mc_clear_src(struct ip_mc_list *pmc) | 2073 | static void ip_mc_clear_src(struct ip_mc_list *pmc) |
2073 | { | 2074 | { |
2074 | struct ip_sf_list *psf, *nextpsf; | 2075 | struct ip_sf_list *psf, *nextpsf, *tomb, *sources; |
2075 | 2076 | ||
2076 | for (psf = pmc->tomb; psf; psf = nextpsf) { | 2077 | spin_lock_bh(&pmc->lock); |
2078 | tomb = pmc->tomb; | ||
2079 | pmc->tomb = NULL; | ||
2080 | sources = pmc->sources; | ||
2081 | pmc->sources = NULL; | ||
2082 | pmc->sfmode = MCAST_EXCLUDE; | ||
2083 | pmc->sfcount[MCAST_INCLUDE] = 0; | ||
2084 | pmc->sfcount[MCAST_EXCLUDE] = 1; | ||
2085 | spin_unlock_bh(&pmc->lock); | ||
2086 | |||
2087 | for (psf = tomb; psf; psf = nextpsf) { | ||
2077 | nextpsf = psf->sf_next; | 2088 | nextpsf = psf->sf_next; |
2078 | kfree(psf); | 2089 | kfree(psf); |
2079 | } | 2090 | } |
2080 | pmc->tomb = NULL; | 2091 | for (psf = sources; psf; psf = nextpsf) { |
2081 | for (psf = pmc->sources; psf; psf = nextpsf) { | ||
2082 | nextpsf = psf->sf_next; | 2092 | nextpsf = psf->sf_next; |
2083 | kfree(psf); | 2093 | kfree(psf); |
2084 | } | 2094 | } |
2085 | pmc->sources = NULL; | ||
2086 | pmc->sfmode = MCAST_EXCLUDE; | ||
2087 | pmc->sfcount[MCAST_INCLUDE] = 0; | ||
2088 | pmc->sfcount[MCAST_EXCLUDE] = 1; | ||
2089 | } | 2095 | } |
2090 | 2096 | ||
2091 | /* Join a multicast group | 2097 | /* Join a multicast group |
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index b878ecbc0608..129d1a3616f8 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
@@ -446,6 +446,8 @@ int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb, | |||
446 | return 0; | 446 | return 0; |
447 | 447 | ||
448 | drop: | 448 | drop: |
449 | if (tun_dst) | ||
450 | dst_release((struct dst_entry *)tun_dst); | ||
449 | kfree_skb(skb); | 451 | kfree_skb(skb); |
450 | return 0; | 452 | return 0; |
451 | } | 453 | } |
@@ -967,7 +969,6 @@ static void ip_tunnel_dev_free(struct net_device *dev) | |||
967 | gro_cells_destroy(&tunnel->gro_cells); | 969 | gro_cells_destroy(&tunnel->gro_cells); |
968 | dst_cache_destroy(&tunnel->dst_cache); | 970 | dst_cache_destroy(&tunnel->dst_cache); |
969 | free_percpu(dev->tstats); | 971 | free_percpu(dev->tstats); |
970 | free_netdev(dev); | ||
971 | } | 972 | } |
972 | 973 | ||
973 | void ip_tunnel_dellink(struct net_device *dev, struct list_head *head) | 974 | void ip_tunnel_dellink(struct net_device *dev, struct list_head *head) |
@@ -1155,7 +1156,8 @@ int ip_tunnel_init(struct net_device *dev) | |||
1155 | struct iphdr *iph = &tunnel->parms.iph; | 1156 | struct iphdr *iph = &tunnel->parms.iph; |
1156 | int err; | 1157 | int err; |
1157 | 1158 | ||
1158 | dev->destructor = ip_tunnel_dev_free; | 1159 | dev->needs_free_netdev = true; |
1160 | dev->priv_destructor = ip_tunnel_dev_free; | ||
1159 | dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); | 1161 | dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); |
1160 | if (!dev->tstats) | 1162 | if (!dev->tstats) |
1161 | return -ENOMEM; | 1163 | return -ENOMEM; |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 551de4d023a8..8ae425cad818 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -101,8 +101,8 @@ static struct mr_table *ipmr_new_table(struct net *net, u32 id); | |||
101 | static void ipmr_free_table(struct mr_table *mrt); | 101 | static void ipmr_free_table(struct mr_table *mrt); |
102 | 102 | ||
103 | static void ip_mr_forward(struct net *net, struct mr_table *mrt, | 103 | static void ip_mr_forward(struct net *net, struct mr_table *mrt, |
104 | struct sk_buff *skb, struct mfc_cache *cache, | 104 | struct net_device *dev, struct sk_buff *skb, |
105 | int local); | 105 | struct mfc_cache *cache, int local); |
106 | static int ipmr_cache_report(struct mr_table *mrt, | 106 | static int ipmr_cache_report(struct mr_table *mrt, |
107 | struct sk_buff *pkt, vifi_t vifi, int assert); | 107 | struct sk_buff *pkt, vifi_t vifi, int assert); |
108 | static int __ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, | 108 | static int __ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, |
@@ -501,7 +501,7 @@ static void reg_vif_setup(struct net_device *dev) | |||
501 | dev->mtu = ETH_DATA_LEN - sizeof(struct iphdr) - 8; | 501 | dev->mtu = ETH_DATA_LEN - sizeof(struct iphdr) - 8; |
502 | dev->flags = IFF_NOARP; | 502 | dev->flags = IFF_NOARP; |
503 | dev->netdev_ops = ®_vif_netdev_ops; | 503 | dev->netdev_ops = ®_vif_netdev_ops; |
504 | dev->destructor = free_netdev; | 504 | dev->needs_free_netdev = true; |
505 | dev->features |= NETIF_F_NETNS_LOCAL; | 505 | dev->features |= NETIF_F_NETNS_LOCAL; |
506 | } | 506 | } |
507 | 507 | ||
@@ -988,7 +988,7 @@ static void ipmr_cache_resolve(struct net *net, struct mr_table *mrt, | |||
988 | 988 | ||
989 | rtnl_unicast(skb, net, NETLINK_CB(skb).portid); | 989 | rtnl_unicast(skb, net, NETLINK_CB(skb).portid); |
990 | } else { | 990 | } else { |
991 | ip_mr_forward(net, mrt, skb, c, 0); | 991 | ip_mr_forward(net, mrt, skb->dev, skb, c, 0); |
992 | } | 992 | } |
993 | } | 993 | } |
994 | } | 994 | } |
@@ -1073,7 +1073,7 @@ static int ipmr_cache_report(struct mr_table *mrt, | |||
1073 | 1073 | ||
1074 | /* Queue a packet for resolution. It gets locked cache entry! */ | 1074 | /* Queue a packet for resolution. It gets locked cache entry! */ |
1075 | static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi, | 1075 | static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi, |
1076 | struct sk_buff *skb) | 1076 | struct sk_buff *skb, struct net_device *dev) |
1077 | { | 1077 | { |
1078 | const struct iphdr *iph = ip_hdr(skb); | 1078 | const struct iphdr *iph = ip_hdr(skb); |
1079 | struct mfc_cache *c; | 1079 | struct mfc_cache *c; |
@@ -1130,6 +1130,10 @@ static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi, | |||
1130 | kfree_skb(skb); | 1130 | kfree_skb(skb); |
1131 | err = -ENOBUFS; | 1131 | err = -ENOBUFS; |
1132 | } else { | 1132 | } else { |
1133 | if (dev) { | ||
1134 | skb->dev = dev; | ||
1135 | skb->skb_iif = dev->ifindex; | ||
1136 | } | ||
1133 | skb_queue_tail(&c->mfc_un.unres.unresolved, skb); | 1137 | skb_queue_tail(&c->mfc_un.unres.unresolved, skb); |
1134 | err = 0; | 1138 | err = 0; |
1135 | } | 1139 | } |
@@ -1828,10 +1832,10 @@ static int ipmr_find_vif(struct mr_table *mrt, struct net_device *dev) | |||
1828 | 1832 | ||
1829 | /* "local" means that we should preserve one skb (for local delivery) */ | 1833 | /* "local" means that we should preserve one skb (for local delivery) */ |
1830 | static void ip_mr_forward(struct net *net, struct mr_table *mrt, | 1834 | static void ip_mr_forward(struct net *net, struct mr_table *mrt, |
1831 | struct sk_buff *skb, struct mfc_cache *cache, | 1835 | struct net_device *dev, struct sk_buff *skb, |
1832 | int local) | 1836 | struct mfc_cache *cache, int local) |
1833 | { | 1837 | { |
1834 | int true_vifi = ipmr_find_vif(mrt, skb->dev); | 1838 | int true_vifi = ipmr_find_vif(mrt, dev); |
1835 | int psend = -1; | 1839 | int psend = -1; |
1836 | int vif, ct; | 1840 | int vif, ct; |
1837 | 1841 | ||
@@ -1853,13 +1857,7 @@ static void ip_mr_forward(struct net *net, struct mr_table *mrt, | |||
1853 | } | 1857 | } |
1854 | 1858 | ||
1855 | /* Wrong interface: drop packet and (maybe) send PIM assert. */ | 1859 | /* Wrong interface: drop packet and (maybe) send PIM assert. */ |
1856 | if (mrt->vif_table[vif].dev != skb->dev) { | 1860 | if (mrt->vif_table[vif].dev != dev) { |
1857 | struct net_device *mdev; | ||
1858 | |||
1859 | mdev = l3mdev_master_dev_rcu(mrt->vif_table[vif].dev); | ||
1860 | if (mdev == skb->dev) | ||
1861 | goto forward; | ||
1862 | |||
1863 | if (rt_is_output_route(skb_rtable(skb))) { | 1861 | if (rt_is_output_route(skb_rtable(skb))) { |
1864 | /* It is our own packet, looped back. | 1862 | /* It is our own packet, looped back. |
1865 | * Very complicated situation... | 1863 | * Very complicated situation... |
@@ -2053,7 +2051,7 @@ int ip_mr_input(struct sk_buff *skb) | |||
2053 | read_lock(&mrt_lock); | 2051 | read_lock(&mrt_lock); |
2054 | vif = ipmr_find_vif(mrt, dev); | 2052 | vif = ipmr_find_vif(mrt, dev); |
2055 | if (vif >= 0) { | 2053 | if (vif >= 0) { |
2056 | int err2 = ipmr_cache_unresolved(mrt, vif, skb); | 2054 | int err2 = ipmr_cache_unresolved(mrt, vif, skb, dev); |
2057 | read_unlock(&mrt_lock); | 2055 | read_unlock(&mrt_lock); |
2058 | 2056 | ||
2059 | return err2; | 2057 | return err2; |
@@ -2064,7 +2062,7 @@ int ip_mr_input(struct sk_buff *skb) | |||
2064 | } | 2062 | } |
2065 | 2063 | ||
2066 | read_lock(&mrt_lock); | 2064 | read_lock(&mrt_lock); |
2067 | ip_mr_forward(net, mrt, skb, cache, local); | 2065 | ip_mr_forward(net, mrt, dev, skb, cache, local); |
2068 | read_unlock(&mrt_lock); | 2066 | read_unlock(&mrt_lock); |
2069 | 2067 | ||
2070 | if (local) | 2068 | if (local) |
@@ -2238,7 +2236,7 @@ int ipmr_get_route(struct net *net, struct sk_buff *skb, | |||
2238 | iph->saddr = saddr; | 2236 | iph->saddr = saddr; |
2239 | iph->daddr = daddr; | 2237 | iph->daddr = daddr; |
2240 | iph->version = 0; | 2238 | iph->version = 0; |
2241 | err = ipmr_cache_unresolved(mrt, vif, skb2); | 2239 | err = ipmr_cache_unresolved(mrt, vif, skb2, dev); |
2242 | read_unlock(&mrt_lock); | 2240 | read_unlock(&mrt_lock); |
2243 | rcu_read_unlock(); | 2241 | rcu_read_unlock(); |
2244 | return err; | 2242 | return err; |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 6a4fb1e629fb..686c92375e81 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -332,9 +332,9 @@ static void addrconf_mod_rs_timer(struct inet6_dev *idev, | |||
332 | static void addrconf_mod_dad_work(struct inet6_ifaddr *ifp, | 332 | static void addrconf_mod_dad_work(struct inet6_ifaddr *ifp, |
333 | unsigned long delay) | 333 | unsigned long delay) |
334 | { | 334 | { |
335 | if (!delayed_work_pending(&ifp->dad_work)) | 335 | in6_ifa_hold(ifp); |
336 | in6_ifa_hold(ifp); | 336 | if (mod_delayed_work(addrconf_wq, &ifp->dad_work, delay)) |
337 | mod_delayed_work(addrconf_wq, &ifp->dad_work, delay); | 337 | in6_ifa_put(ifp); |
338 | } | 338 | } |
339 | 339 | ||
340 | static int snmp6_alloc_dev(struct inet6_dev *idev) | 340 | static int snmp6_alloc_dev(struct inet6_dev *idev) |
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index eea23b57c6a5..ec849d88a662 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c | |||
@@ -32,7 +32,6 @@ struct fib6_rule { | |||
32 | struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, | 32 | struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, |
33 | int flags, pol_lookup_t lookup) | 33 | int flags, pol_lookup_t lookup) |
34 | { | 34 | { |
35 | struct rt6_info *rt; | ||
36 | struct fib_lookup_arg arg = { | 35 | struct fib_lookup_arg arg = { |
37 | .lookup_ptr = lookup, | 36 | .lookup_ptr = lookup, |
38 | .flags = FIB_LOOKUP_NOREF, | 37 | .flags = FIB_LOOKUP_NOREF, |
@@ -44,21 +43,11 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, | |||
44 | fib_rules_lookup(net->ipv6.fib6_rules_ops, | 43 | fib_rules_lookup(net->ipv6.fib6_rules_ops, |
45 | flowi6_to_flowi(fl6), flags, &arg); | 44 | flowi6_to_flowi(fl6), flags, &arg); |
46 | 45 | ||
47 | rt = arg.result; | 46 | if (arg.result) |
47 | return arg.result; | ||
48 | 48 | ||
49 | if (!rt) { | 49 | dst_hold(&net->ipv6.ip6_null_entry->dst); |
50 | dst_hold(&net->ipv6.ip6_null_entry->dst); | 50 | return &net->ipv6.ip6_null_entry->dst; |
51 | return &net->ipv6.ip6_null_entry->dst; | ||
52 | } | ||
53 | |||
54 | if (rt->rt6i_flags & RTF_REJECT && | ||
55 | rt->dst.error == -EAGAIN) { | ||
56 | ip6_rt_put(rt); | ||
57 | rt = net->ipv6.ip6_null_entry; | ||
58 | dst_hold(&rt->dst); | ||
59 | } | ||
60 | |||
61 | return &rt->dst; | ||
62 | } | 51 | } |
63 | 52 | ||
64 | static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, | 53 | static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, |
@@ -121,7 +110,8 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, | |||
121 | flp6->saddr = saddr; | 110 | flp6->saddr = saddr; |
122 | } | 111 | } |
123 | err = rt->dst.error; | 112 | err = rt->dst.error; |
124 | goto out; | 113 | if (err != -EAGAIN) |
114 | goto out; | ||
125 | } | 115 | } |
126 | again: | 116 | again: |
127 | ip6_rt_put(rt); | 117 | ip6_rt_put(rt); |
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 230b5aac9f03..8d7b113958b1 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -491,7 +491,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, | |||
491 | local_bh_disable(); | 491 | local_bh_disable(); |
492 | 492 | ||
493 | /* Check global sysctl_icmp_msgs_per_sec ratelimit */ | 493 | /* Check global sysctl_icmp_msgs_per_sec ratelimit */ |
494 | if (!icmpv6_global_allow(type)) | 494 | if (!(skb->dev->flags&IFF_LOOPBACK) && !icmpv6_global_allow(type)) |
495 | goto out_bh_enable; | 495 | goto out_bh_enable; |
496 | 496 | ||
497 | mip6_addr_swap(skb); | 497 | mip6_addr_swap(skb); |
diff --git a/net/ipv6/ila/ila_xlat.c b/net/ipv6/ila/ila_xlat.c index 2fd5ca151dcf..77f7f8c7d93d 100644 --- a/net/ipv6/ila/ila_xlat.c +++ b/net/ipv6/ila/ila_xlat.c | |||
@@ -62,6 +62,7 @@ static inline u32 ila_locator_hash(struct ila_locator loc) | |||
62 | { | 62 | { |
63 | u32 *v = (u32 *)loc.v32; | 63 | u32 *v = (u32 *)loc.v32; |
64 | 64 | ||
65 | __ila_hash_secret_init(); | ||
65 | return jhash_2words(v[0], v[1], hashrnd); | 66 | return jhash_2words(v[0], v[1], hashrnd); |
66 | } | 67 | } |
67 | 68 | ||
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index d4bf2c68a545..e6b78ba0e636 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -289,8 +289,7 @@ struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, | |||
289 | struct rt6_info *rt; | 289 | struct rt6_info *rt; |
290 | 290 | ||
291 | rt = lookup(net, net->ipv6.fib6_main_tbl, fl6, flags); | 291 | rt = lookup(net, net->ipv6.fib6_main_tbl, fl6, flags); |
292 | if (rt->rt6i_flags & RTF_REJECT && | 292 | if (rt->dst.error == -EAGAIN) { |
293 | rt->dst.error == -EAGAIN) { | ||
294 | ip6_rt_put(rt); | 293 | ip6_rt_put(rt); |
295 | rt = net->ipv6.ip6_null_entry; | 294 | rt = net->ipv6.ip6_null_entry; |
296 | dst_hold(&rt->dst); | 295 | dst_hold(&rt->dst); |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 0c5b4caa1949..64eea3962733 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -991,13 +991,13 @@ static void ip6gre_dev_free(struct net_device *dev) | |||
991 | 991 | ||
992 | dst_cache_destroy(&t->dst_cache); | 992 | dst_cache_destroy(&t->dst_cache); |
993 | free_percpu(dev->tstats); | 993 | free_percpu(dev->tstats); |
994 | free_netdev(dev); | ||
995 | } | 994 | } |
996 | 995 | ||
997 | static void ip6gre_tunnel_setup(struct net_device *dev) | 996 | static void ip6gre_tunnel_setup(struct net_device *dev) |
998 | { | 997 | { |
999 | dev->netdev_ops = &ip6gre_netdev_ops; | 998 | dev->netdev_ops = &ip6gre_netdev_ops; |
1000 | dev->destructor = ip6gre_dev_free; | 999 | dev->needs_free_netdev = true; |
1000 | dev->priv_destructor = ip6gre_dev_free; | ||
1001 | 1001 | ||
1002 | dev->type = ARPHRD_IP6GRE; | 1002 | dev->type = ARPHRD_IP6GRE; |
1003 | 1003 | ||
@@ -1148,7 +1148,7 @@ static int __net_init ip6gre_init_net(struct net *net) | |||
1148 | return 0; | 1148 | return 0; |
1149 | 1149 | ||
1150 | err_reg_dev: | 1150 | err_reg_dev: |
1151 | ip6gre_dev_free(ign->fb_tunnel_dev); | 1151 | free_netdev(ign->fb_tunnel_dev); |
1152 | err_alloc_dev: | 1152 | err_alloc_dev: |
1153 | return err; | 1153 | return err; |
1154 | } | 1154 | } |
@@ -1300,7 +1300,8 @@ static void ip6gre_tap_setup(struct net_device *dev) | |||
1300 | ether_setup(dev); | 1300 | ether_setup(dev); |
1301 | 1301 | ||
1302 | dev->netdev_ops = &ip6gre_tap_netdev_ops; | 1302 | dev->netdev_ops = &ip6gre_tap_netdev_ops; |
1303 | dev->destructor = ip6gre_dev_free; | 1303 | dev->needs_free_netdev = true; |
1304 | dev->priv_destructor = ip6gre_dev_free; | ||
1304 | 1305 | ||
1305 | dev->features |= NETIF_F_NETNS_LOCAL; | 1306 | dev->features |= NETIF_F_NETNS_LOCAL; |
1306 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; | 1307 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 9b37f9747fc6..8c6c3c8e7eef 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -254,7 +254,6 @@ static void ip6_dev_free(struct net_device *dev) | |||
254 | gro_cells_destroy(&t->gro_cells); | 254 | gro_cells_destroy(&t->gro_cells); |
255 | dst_cache_destroy(&t->dst_cache); | 255 | dst_cache_destroy(&t->dst_cache); |
256 | free_percpu(dev->tstats); | 256 | free_percpu(dev->tstats); |
257 | free_netdev(dev); | ||
258 | } | 257 | } |
259 | 258 | ||
260 | static int ip6_tnl_create2(struct net_device *dev) | 259 | static int ip6_tnl_create2(struct net_device *dev) |
@@ -322,7 +321,7 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p) | |||
322 | return t; | 321 | return t; |
323 | 322 | ||
324 | failed_free: | 323 | failed_free: |
325 | ip6_dev_free(dev); | 324 | free_netdev(dev); |
326 | failed: | 325 | failed: |
327 | return ERR_PTR(err); | 326 | return ERR_PTR(err); |
328 | } | 327 | } |
@@ -859,6 +858,8 @@ static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, | |||
859 | return 0; | 858 | return 0; |
860 | 859 | ||
861 | drop: | 860 | drop: |
861 | if (tun_dst) | ||
862 | dst_release((struct dst_entry *)tun_dst); | ||
862 | kfree_skb(skb); | 863 | kfree_skb(skb); |
863 | return 0; | 864 | return 0; |
864 | } | 865 | } |
@@ -1247,7 +1248,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1247 | fl6.flowi6_proto = IPPROTO_IPIP; | 1248 | fl6.flowi6_proto = IPPROTO_IPIP; |
1248 | fl6.daddr = key->u.ipv6.dst; | 1249 | fl6.daddr = key->u.ipv6.dst; |
1249 | fl6.flowlabel = key->label; | 1250 | fl6.flowlabel = key->label; |
1250 | dsfield = ip6_tclass(key->label); | 1251 | dsfield = key->tos; |
1251 | } else { | 1252 | } else { |
1252 | if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) | 1253 | if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) |
1253 | encap_limit = t->parms.encap_limit; | 1254 | encap_limit = t->parms.encap_limit; |
@@ -1318,7 +1319,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1318 | fl6.flowi6_proto = IPPROTO_IPV6; | 1319 | fl6.flowi6_proto = IPPROTO_IPV6; |
1319 | fl6.daddr = key->u.ipv6.dst; | 1320 | fl6.daddr = key->u.ipv6.dst; |
1320 | fl6.flowlabel = key->label; | 1321 | fl6.flowlabel = key->label; |
1321 | dsfield = ip6_tclass(key->label); | 1322 | dsfield = key->tos; |
1322 | } else { | 1323 | } else { |
1323 | offset = ip6_tnl_parse_tlv_enc_lim(skb, skb_network_header(skb)); | 1324 | offset = ip6_tnl_parse_tlv_enc_lim(skb, skb_network_header(skb)); |
1324 | /* ip6_tnl_parse_tlv_enc_lim() might have reallocated skb->head */ | 1325 | /* ip6_tnl_parse_tlv_enc_lim() might have reallocated skb->head */ |
@@ -1777,7 +1778,8 @@ static const struct net_device_ops ip6_tnl_netdev_ops = { | |||
1777 | static void ip6_tnl_dev_setup(struct net_device *dev) | 1778 | static void ip6_tnl_dev_setup(struct net_device *dev) |
1778 | { | 1779 | { |
1779 | dev->netdev_ops = &ip6_tnl_netdev_ops; | 1780 | dev->netdev_ops = &ip6_tnl_netdev_ops; |
1780 | dev->destructor = ip6_dev_free; | 1781 | dev->needs_free_netdev = true; |
1782 | dev->priv_destructor = ip6_dev_free; | ||
1781 | 1783 | ||
1782 | dev->type = ARPHRD_TUNNEL6; | 1784 | dev->type = ARPHRD_TUNNEL6; |
1783 | dev->flags |= IFF_NOARP; | 1785 | dev->flags |= IFF_NOARP; |
@@ -2224,7 +2226,7 @@ static int __net_init ip6_tnl_init_net(struct net *net) | |||
2224 | return 0; | 2226 | return 0; |
2225 | 2227 | ||
2226 | err_register: | 2228 | err_register: |
2227 | ip6_dev_free(ip6n->fb_tnl_dev); | 2229 | free_netdev(ip6n->fb_tnl_dev); |
2228 | err_alloc_dev: | 2230 | err_alloc_dev: |
2229 | return err; | 2231 | return err; |
2230 | } | 2232 | } |
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index d67ef56454b2..837ea1eefe7f 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c | |||
@@ -180,7 +180,6 @@ vti6_tnl_unlink(struct vti6_net *ip6n, struct ip6_tnl *t) | |||
180 | static void vti6_dev_free(struct net_device *dev) | 180 | static void vti6_dev_free(struct net_device *dev) |
181 | { | 181 | { |
182 | free_percpu(dev->tstats); | 182 | free_percpu(dev->tstats); |
183 | free_netdev(dev); | ||
184 | } | 183 | } |
185 | 184 | ||
186 | static int vti6_tnl_create2(struct net_device *dev) | 185 | static int vti6_tnl_create2(struct net_device *dev) |
@@ -235,7 +234,7 @@ static struct ip6_tnl *vti6_tnl_create(struct net *net, struct __ip6_tnl_parm *p | |||
235 | return t; | 234 | return t; |
236 | 235 | ||
237 | failed_free: | 236 | failed_free: |
238 | vti6_dev_free(dev); | 237 | free_netdev(dev); |
239 | failed: | 238 | failed: |
240 | return NULL; | 239 | return NULL; |
241 | } | 240 | } |
@@ -842,7 +841,8 @@ static const struct net_device_ops vti6_netdev_ops = { | |||
842 | static void vti6_dev_setup(struct net_device *dev) | 841 | static void vti6_dev_setup(struct net_device *dev) |
843 | { | 842 | { |
844 | dev->netdev_ops = &vti6_netdev_ops; | 843 | dev->netdev_ops = &vti6_netdev_ops; |
845 | dev->destructor = vti6_dev_free; | 844 | dev->needs_free_netdev = true; |
845 | dev->priv_destructor = vti6_dev_free; | ||
846 | 846 | ||
847 | dev->type = ARPHRD_TUNNEL6; | 847 | dev->type = ARPHRD_TUNNEL6; |
848 | dev->hard_header_len = LL_MAX_HEADER + sizeof(struct ipv6hdr); | 848 | dev->hard_header_len = LL_MAX_HEADER + sizeof(struct ipv6hdr); |
@@ -1100,7 +1100,7 @@ static int __net_init vti6_init_net(struct net *net) | |||
1100 | return 0; | 1100 | return 0; |
1101 | 1101 | ||
1102 | err_register: | 1102 | err_register: |
1103 | vti6_dev_free(ip6n->fb_tnl_dev); | 1103 | free_netdev(ip6n->fb_tnl_dev); |
1104 | err_alloc_dev: | 1104 | err_alloc_dev: |
1105 | return err; | 1105 | return err; |
1106 | } | 1106 | } |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 374997d26488..2ecb39b943b5 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -733,7 +733,7 @@ static void reg_vif_setup(struct net_device *dev) | |||
733 | dev->mtu = 1500 - sizeof(struct ipv6hdr) - 8; | 733 | dev->mtu = 1500 - sizeof(struct ipv6hdr) - 8; |
734 | dev->flags = IFF_NOARP; | 734 | dev->flags = IFF_NOARP; |
735 | dev->netdev_ops = ®_vif_netdev_ops; | 735 | dev->netdev_ops = ®_vif_netdev_ops; |
736 | dev->destructor = free_netdev; | 736 | dev->needs_free_netdev = true; |
737 | dev->features |= NETIF_F_NETNS_LOCAL; | 737 | dev->features |= NETIF_F_NETNS_LOCAL; |
738 | } | 738 | } |
739 | 739 | ||
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index cc8e3ae9ca73..e88bcb8ff0fd 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c | |||
@@ -219,7 +219,7 @@ static void snmp6_seq_show_item64(struct seq_file *seq, void __percpu *mib, | |||
219 | u64 buff64[SNMP_MIB_MAX]; | 219 | u64 buff64[SNMP_MIB_MAX]; |
220 | int i; | 220 | int i; |
221 | 221 | ||
222 | memset(buff64, 0, sizeof(unsigned long) * SNMP_MIB_MAX); | 222 | memset(buff64, 0, sizeof(u64) * SNMP_MIB_MAX); |
223 | 223 | ||
224 | snmp_get_cpu_field64_batch(buff64, itemlist, mib, syncpoff); | 224 | snmp_get_cpu_field64_batch(buff64, itemlist, mib, syncpoff); |
225 | for (i = 0; itemlist[i].name; i++) | 225 | for (i = 0; itemlist[i].name; i++) |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index dc61b0b5e64e..7cebd954d5bb 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -2804,6 +2804,7 @@ static int fib6_ifdown(struct rt6_info *rt, void *arg) | |||
2804 | if ((rt->dst.dev == dev || !dev) && | 2804 | if ((rt->dst.dev == dev || !dev) && |
2805 | rt != adn->net->ipv6.ip6_null_entry && | 2805 | rt != adn->net->ipv6.ip6_null_entry && |
2806 | (rt->rt6i_nsiblings == 0 || | 2806 | (rt->rt6i_nsiblings == 0 || |
2807 | (dev && netdev_unregistering(dev)) || | ||
2807 | !rt->rt6i_idev->cnf.ignore_routes_with_linkdown)) | 2808 | !rt->rt6i_idev->cnf.ignore_routes_with_linkdown)) |
2808 | return -1; | 2809 | return -1; |
2809 | 2810 | ||
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 61e5902f0687..2378503577b0 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -265,7 +265,7 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net, | |||
265 | return nt; | 265 | return nt; |
266 | 266 | ||
267 | failed_free: | 267 | failed_free: |
268 | ipip6_dev_free(dev); | 268 | free_netdev(dev); |
269 | failed: | 269 | failed: |
270 | return NULL; | 270 | return NULL; |
271 | } | 271 | } |
@@ -1336,7 +1336,6 @@ static void ipip6_dev_free(struct net_device *dev) | |||
1336 | 1336 | ||
1337 | dst_cache_destroy(&tunnel->dst_cache); | 1337 | dst_cache_destroy(&tunnel->dst_cache); |
1338 | free_percpu(dev->tstats); | 1338 | free_percpu(dev->tstats); |
1339 | free_netdev(dev); | ||
1340 | } | 1339 | } |
1341 | 1340 | ||
1342 | #define SIT_FEATURES (NETIF_F_SG | \ | 1341 | #define SIT_FEATURES (NETIF_F_SG | \ |
@@ -1351,7 +1350,8 @@ static void ipip6_tunnel_setup(struct net_device *dev) | |||
1351 | int t_hlen = tunnel->hlen + sizeof(struct iphdr); | 1350 | int t_hlen = tunnel->hlen + sizeof(struct iphdr); |
1352 | 1351 | ||
1353 | dev->netdev_ops = &ipip6_netdev_ops; | 1352 | dev->netdev_ops = &ipip6_netdev_ops; |
1354 | dev->destructor = ipip6_dev_free; | 1353 | dev->needs_free_netdev = true; |
1354 | dev->priv_destructor = ipip6_dev_free; | ||
1355 | 1355 | ||
1356 | dev->type = ARPHRD_SIT; | 1356 | dev->type = ARPHRD_SIT; |
1357 | dev->hard_header_len = LL_MAX_HEADER + t_hlen; | 1357 | dev->hard_header_len = LL_MAX_HEADER + t_hlen; |
diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c index 74d09f91709e..3be852808a9d 100644 --- a/net/irda/irlan/irlan_eth.c +++ b/net/irda/irlan/irlan_eth.c | |||
@@ -65,7 +65,7 @@ static void irlan_eth_setup(struct net_device *dev) | |||
65 | ether_setup(dev); | 65 | ether_setup(dev); |
66 | 66 | ||
67 | dev->netdev_ops = &irlan_eth_netdev_ops; | 67 | dev->netdev_ops = &irlan_eth_netdev_ops; |
68 | dev->destructor = free_netdev; | 68 | dev->needs_free_netdev = true; |
69 | dev->min_mtu = 0; | 69 | dev->min_mtu = 0; |
70 | dev->max_mtu = ETH_MAX_MTU; | 70 | dev->max_mtu = ETH_MAX_MTU; |
71 | 71 | ||
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c index 8b21af7321b9..4de2ec94b08c 100644 --- a/net/l2tp/l2tp_eth.c +++ b/net/l2tp/l2tp_eth.c | |||
@@ -114,12 +114,13 @@ static void l2tp_eth_get_stats64(struct net_device *dev, | |||
114 | { | 114 | { |
115 | struct l2tp_eth *priv = netdev_priv(dev); | 115 | struct l2tp_eth *priv = netdev_priv(dev); |
116 | 116 | ||
117 | stats->tx_bytes = atomic_long_read(&priv->tx_bytes); | 117 | stats->tx_bytes = (unsigned long) atomic_long_read(&priv->tx_bytes); |
118 | stats->tx_packets = atomic_long_read(&priv->tx_packets); | 118 | stats->tx_packets = (unsigned long) atomic_long_read(&priv->tx_packets); |
119 | stats->tx_dropped = atomic_long_read(&priv->tx_dropped); | 119 | stats->tx_dropped = (unsigned long) atomic_long_read(&priv->tx_dropped); |
120 | stats->rx_bytes = atomic_long_read(&priv->rx_bytes); | 120 | stats->rx_bytes = (unsigned long) atomic_long_read(&priv->rx_bytes); |
121 | stats->rx_packets = atomic_long_read(&priv->rx_packets); | 121 | stats->rx_packets = (unsigned long) atomic_long_read(&priv->rx_packets); |
122 | stats->rx_errors = atomic_long_read(&priv->rx_errors); | 122 | stats->rx_errors = (unsigned long) atomic_long_read(&priv->rx_errors); |
123 | |||
123 | } | 124 | } |
124 | 125 | ||
125 | static const struct net_device_ops l2tp_eth_netdev_ops = { | 126 | static const struct net_device_ops l2tp_eth_netdev_ops = { |
@@ -141,7 +142,7 @@ static void l2tp_eth_dev_setup(struct net_device *dev) | |||
141 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; | 142 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
142 | dev->features |= NETIF_F_LLTX; | 143 | dev->features |= NETIF_F_LLTX; |
143 | dev->netdev_ops = &l2tp_eth_netdev_ops; | 144 | dev->netdev_ops = &l2tp_eth_netdev_ops; |
144 | dev->destructor = free_netdev; | 145 | dev->needs_free_netdev = true; |
145 | } | 146 | } |
146 | 147 | ||
147 | static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, int data_len) | 148 | static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, int data_len) |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 6c2e6060cd54..4a388fe8c2d1 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -902,6 +902,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, | |||
902 | default: | 902 | default: |
903 | return -EINVAL; | 903 | return -EINVAL; |
904 | } | 904 | } |
905 | sdata->u.ap.req_smps = sdata->smps_mode; | ||
906 | |||
905 | sdata->needed_rx_chains = sdata->local->rx_chains; | 907 | sdata->needed_rx_chains = sdata->local->rx_chains; |
906 | 908 | ||
907 | sdata->vif.bss_conf.beacon_int = params->beacon_interval; | 909 | sdata->vif.bss_conf.beacon_int = params->beacon_interval; |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 665501ac358f..5e002f62c235 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1531,7 +1531,7 @@ ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status) | |||
1531 | return true; | 1531 | return true; |
1532 | /* can't handle non-legacy preamble yet */ | 1532 | /* can't handle non-legacy preamble yet */ |
1533 | if (status->flag & RX_FLAG_MACTIME_PLCP_START && | 1533 | if (status->flag & RX_FLAG_MACTIME_PLCP_START && |
1534 | status->encoding != RX_ENC_LEGACY) | 1534 | status->encoding == RX_ENC_LEGACY) |
1535 | return true; | 1535 | return true; |
1536 | return false; | 1536 | return false; |
1537 | } | 1537 | } |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 8fae1a72e6a7..f5f50150ba1c 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -1213,7 +1213,6 @@ static const struct net_device_ops ieee80211_monitorif_ops = { | |||
1213 | static void ieee80211_if_free(struct net_device *dev) | 1213 | static void ieee80211_if_free(struct net_device *dev) |
1214 | { | 1214 | { |
1215 | free_percpu(dev->tstats); | 1215 | free_percpu(dev->tstats); |
1216 | free_netdev(dev); | ||
1217 | } | 1216 | } |
1218 | 1217 | ||
1219 | static void ieee80211_if_setup(struct net_device *dev) | 1218 | static void ieee80211_if_setup(struct net_device *dev) |
@@ -1221,7 +1220,8 @@ static void ieee80211_if_setup(struct net_device *dev) | |||
1221 | ether_setup(dev); | 1220 | ether_setup(dev); |
1222 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; | 1221 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
1223 | dev->netdev_ops = &ieee80211_dataif_ops; | 1222 | dev->netdev_ops = &ieee80211_dataif_ops; |
1224 | dev->destructor = ieee80211_if_free; | 1223 | dev->needs_free_netdev = true; |
1224 | dev->priv_destructor = ieee80211_if_free; | ||
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | static void ieee80211_if_setup_no_queue(struct net_device *dev) | 1227 | static void ieee80211_if_setup_no_queue(struct net_device *dev) |
@@ -1816,6 +1816,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
1816 | ret = dev_alloc_name(ndev, ndev->name); | 1816 | ret = dev_alloc_name(ndev, ndev->name); |
1817 | if (ret < 0) { | 1817 | if (ret < 0) { |
1818 | ieee80211_if_free(ndev); | 1818 | ieee80211_if_free(ndev); |
1819 | free_netdev(ndev); | ||
1819 | return ret; | 1820 | return ret; |
1820 | } | 1821 | } |
1821 | 1822 | ||
@@ -1905,7 +1906,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, | |||
1905 | 1906 | ||
1906 | ret = register_netdevice(ndev); | 1907 | ret = register_netdevice(ndev); |
1907 | if (ret) { | 1908 | if (ret) { |
1908 | ieee80211_if_free(ndev); | 1909 | free_netdev(ndev); |
1909 | return ret; | 1910 | return ret; |
1910 | } | 1911 | } |
1911 | } | 1912 | } |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 0ea9712bd99e..cc8e6ea1b27e 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -601,7 +601,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) | |||
601 | struct ieee80211_supported_band *sband; | 601 | struct ieee80211_supported_band *sband; |
602 | struct ieee80211_chanctx_conf *chanctx_conf; | 602 | struct ieee80211_chanctx_conf *chanctx_conf; |
603 | struct ieee80211_channel *chan; | 603 | struct ieee80211_channel *chan; |
604 | u32 rate_flags, rates = 0; | 604 | u32 rates = 0; |
605 | 605 | ||
606 | sdata_assert_lock(sdata); | 606 | sdata_assert_lock(sdata); |
607 | 607 | ||
@@ -612,7 +612,6 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) | |||
612 | return; | 612 | return; |
613 | } | 613 | } |
614 | chan = chanctx_conf->def.chan; | 614 | chan = chanctx_conf->def.chan; |
615 | rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def); | ||
616 | rcu_read_unlock(); | 615 | rcu_read_unlock(); |
617 | sband = local->hw.wiphy->bands[chan->band]; | 616 | sband = local->hw.wiphy->bands[chan->band]; |
618 | shift = ieee80211_vif_get_shift(&sdata->vif); | 617 | shift = ieee80211_vif_get_shift(&sdata->vif); |
@@ -636,9 +635,6 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) | |||
636 | */ | 635 | */ |
637 | rates_len = 0; | 636 | rates_len = 0; |
638 | for (i = 0; i < sband->n_bitrates; i++) { | 637 | for (i = 0; i < sband->n_bitrates; i++) { |
639 | if ((rate_flags & sband->bitrates[i].flags) | ||
640 | != rate_flags) | ||
641 | continue; | ||
642 | rates |= BIT(i); | 638 | rates |= BIT(i); |
643 | rates_len++; | 639 | rates_len++; |
644 | } | 640 | } |
@@ -2818,7 +2814,7 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband, | |||
2818 | u32 *rates, u32 *basic_rates, | 2814 | u32 *rates, u32 *basic_rates, |
2819 | bool *have_higher_than_11mbit, | 2815 | bool *have_higher_than_11mbit, |
2820 | int *min_rate, int *min_rate_index, | 2816 | int *min_rate, int *min_rate_index, |
2821 | int shift, u32 rate_flags) | 2817 | int shift) |
2822 | { | 2818 | { |
2823 | int i, j; | 2819 | int i, j; |
2824 | 2820 | ||
@@ -2846,8 +2842,6 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband, | |||
2846 | int brate; | 2842 | int brate; |
2847 | 2843 | ||
2848 | br = &sband->bitrates[j]; | 2844 | br = &sband->bitrates[j]; |
2849 | if ((rate_flags & br->flags) != rate_flags) | ||
2850 | continue; | ||
2851 | 2845 | ||
2852 | brate = DIV_ROUND_UP(br->bitrate, (1 << shift) * 5); | 2846 | brate = DIV_ROUND_UP(br->bitrate, (1 << shift) * 5); |
2853 | if (brate == rate) { | 2847 | if (brate == rate) { |
@@ -4398,40 +4392,32 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | |||
4398 | return -ENOMEM; | 4392 | return -ENOMEM; |
4399 | } | 4393 | } |
4400 | 4394 | ||
4401 | if (new_sta || override) { | 4395 | /* |
4402 | err = ieee80211_prep_channel(sdata, cbss); | 4396 | * Set up the information for the new channel before setting the |
4403 | if (err) { | 4397 | * new channel. We can't - completely race-free - change the basic |
4404 | if (new_sta) | 4398 | * rates bitmap and the channel (sband) that it refers to, but if |
4405 | sta_info_free(local, new_sta); | 4399 | * we set it up before we at least avoid calling into the driver's |
4406 | return -EINVAL; | 4400 | * bss_info_changed() method with invalid information (since we do |
4407 | } | 4401 | * call that from changing the channel - only for IDLE and perhaps |
4408 | } | 4402 | * some others, but ...). |
4409 | 4403 | * | |
4404 | * So to avoid that, just set up all the new information before the | ||
4405 | * channel, but tell the driver to apply it only afterwards, since | ||
4406 | * it might need the new channel for that. | ||
4407 | */ | ||
4410 | if (new_sta) { | 4408 | if (new_sta) { |
4411 | u32 rates = 0, basic_rates = 0; | 4409 | u32 rates = 0, basic_rates = 0; |
4412 | bool have_higher_than_11mbit; | 4410 | bool have_higher_than_11mbit; |
4413 | int min_rate = INT_MAX, min_rate_index = -1; | 4411 | int min_rate = INT_MAX, min_rate_index = -1; |
4414 | struct ieee80211_chanctx_conf *chanctx_conf; | ||
4415 | const struct cfg80211_bss_ies *ies; | 4412 | const struct cfg80211_bss_ies *ies; |
4416 | int shift = ieee80211_vif_get_shift(&sdata->vif); | 4413 | int shift = ieee80211_vif_get_shift(&sdata->vif); |
4417 | u32 rate_flags; | ||
4418 | |||
4419 | rcu_read_lock(); | ||
4420 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); | ||
4421 | if (WARN_ON(!chanctx_conf)) { | ||
4422 | rcu_read_unlock(); | ||
4423 | sta_info_free(local, new_sta); | ||
4424 | return -EINVAL; | ||
4425 | } | ||
4426 | rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def); | ||
4427 | rcu_read_unlock(); | ||
4428 | 4414 | ||
4429 | ieee80211_get_rates(sband, bss->supp_rates, | 4415 | ieee80211_get_rates(sband, bss->supp_rates, |
4430 | bss->supp_rates_len, | 4416 | bss->supp_rates_len, |
4431 | &rates, &basic_rates, | 4417 | &rates, &basic_rates, |
4432 | &have_higher_than_11mbit, | 4418 | &have_higher_than_11mbit, |
4433 | &min_rate, &min_rate_index, | 4419 | &min_rate, &min_rate_index, |
4434 | shift, rate_flags); | 4420 | shift); |
4435 | 4421 | ||
4436 | /* | 4422 | /* |
4437 | * This used to be a workaround for basic rates missing | 4423 | * This used to be a workaround for basic rates missing |
@@ -4489,8 +4475,22 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, | |||
4489 | sdata->vif.bss_conf.sync_dtim_count = 0; | 4475 | sdata->vif.bss_conf.sync_dtim_count = 0; |
4490 | } | 4476 | } |
4491 | rcu_read_unlock(); | 4477 | rcu_read_unlock(); |
4478 | } | ||
4492 | 4479 | ||
4493 | /* tell driver about BSSID, basic rates and timing */ | 4480 | if (new_sta || override) { |
4481 | err = ieee80211_prep_channel(sdata, cbss); | ||
4482 | if (err) { | ||
4483 | if (new_sta) | ||
4484 | sta_info_free(local, new_sta); | ||
4485 | return -EINVAL; | ||
4486 | } | ||
4487 | } | ||
4488 | |||
4489 | if (new_sta) { | ||
4490 | /* | ||
4491 | * tell driver about BSSID, basic rates and timing | ||
4492 | * this was set up above, before setting the channel | ||
4493 | */ | ||
4494 | ieee80211_bss_info_change_notify(sdata, | 4494 | ieee80211_bss_info_change_notify(sdata, |
4495 | BSS_CHANGED_BSSID | BSS_CHANGED_BASIC_RATES | | 4495 | BSS_CHANGED_BSSID | BSS_CHANGED_BASIC_RATES | |
4496 | BSS_CHANGED_BEACON_INT); | 4496 | BSS_CHANGED_BEACON_INT); |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 1f75280ba26c..3674fe3d67dc 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1613,12 +1613,16 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | |||
1613 | */ | 1613 | */ |
1614 | if (!ieee80211_hw_check(&sta->local->hw, AP_LINK_PS) && | 1614 | if (!ieee80211_hw_check(&sta->local->hw, AP_LINK_PS) && |
1615 | !ieee80211_has_morefrags(hdr->frame_control) && | 1615 | !ieee80211_has_morefrags(hdr->frame_control) && |
1616 | !ieee80211_is_back_req(hdr->frame_control) && | ||
1616 | !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) && | 1617 | !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) && |
1617 | (rx->sdata->vif.type == NL80211_IFTYPE_AP || | 1618 | (rx->sdata->vif.type == NL80211_IFTYPE_AP || |
1618 | rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN) && | 1619 | rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN) && |
1619 | /* PM bit is only checked in frames where it isn't reserved, | 1620 | /* |
1621 | * PM bit is only checked in frames where it isn't reserved, | ||
1620 | * in AP mode it's reserved in non-bufferable management frames | 1622 | * in AP mode it's reserved in non-bufferable management frames |
1621 | * (cf. IEEE 802.11-2012 8.2.4.1.7 Power Management field) | 1623 | * (cf. IEEE 802.11-2012 8.2.4.1.7 Power Management field) |
1624 | * BAR frames should be ignored as specified in | ||
1625 | * IEEE 802.11-2012 10.2.1.2. | ||
1622 | */ | 1626 | */ |
1623 | (!ieee80211_is_mgmt(hdr->frame_control) || | 1627 | (!ieee80211_is_mgmt(hdr->frame_control) || |
1624 | ieee80211_is_bufferable_mmpdu(hdr->frame_control))) { | 1628 | ieee80211_is_bufferable_mmpdu(hdr->frame_control))) { |
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c index c1ef22df865f..cc19614ff4e6 100644 --- a/net/mac80211/wpa.c +++ b/net/mac80211/wpa.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <asm/unaligned.h> | 17 | #include <asm/unaligned.h> |
18 | #include <net/mac80211.h> | 18 | #include <net/mac80211.h> |
19 | #include <crypto/aes.h> | 19 | #include <crypto/aes.h> |
20 | #include <crypto/algapi.h> | ||
20 | 21 | ||
21 | #include "ieee80211_i.h" | 22 | #include "ieee80211_i.h" |
22 | #include "michael.h" | 23 | #include "michael.h" |
@@ -153,7 +154,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) | |||
153 | data_len = skb->len - hdrlen - MICHAEL_MIC_LEN; | 154 | data_len = skb->len - hdrlen - MICHAEL_MIC_LEN; |
154 | key = &rx->key->conf.key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY]; | 155 | key = &rx->key->conf.key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY]; |
155 | michael_mic(key, hdr, data, data_len, mic); | 156 | michael_mic(key, hdr, data, data_len, mic); |
156 | if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0) | 157 | if (crypto_memneq(mic, data + data_len, MICHAEL_MIC_LEN)) |
157 | goto mic_fail; | 158 | goto mic_fail; |
158 | 159 | ||
159 | /* remove Michael MIC from payload */ | 160 | /* remove Michael MIC from payload */ |
@@ -1048,7 +1049,7 @@ ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx) | |||
1048 | bip_aad(skb, aad); | 1049 | bip_aad(skb, aad); |
1049 | ieee80211_aes_cmac(key->u.aes_cmac.tfm, aad, | 1050 | ieee80211_aes_cmac(key->u.aes_cmac.tfm, aad, |
1050 | skb->data + 24, skb->len - 24, mic); | 1051 | skb->data + 24, skb->len - 24, mic); |
1051 | if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) { | 1052 | if (crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) { |
1052 | key->u.aes_cmac.icverrors++; | 1053 | key->u.aes_cmac.icverrors++; |
1053 | return RX_DROP_UNUSABLE; | 1054 | return RX_DROP_UNUSABLE; |
1054 | } | 1055 | } |
@@ -1098,7 +1099,7 @@ ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx) | |||
1098 | bip_aad(skb, aad); | 1099 | bip_aad(skb, aad); |
1099 | ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad, | 1100 | ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad, |
1100 | skb->data + 24, skb->len - 24, mic); | 1101 | skb->data + 24, skb->len - 24, mic); |
1101 | if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) { | 1102 | if (crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) { |
1102 | key->u.aes_cmac.icverrors++; | 1103 | key->u.aes_cmac.icverrors++; |
1103 | return RX_DROP_UNUSABLE; | 1104 | return RX_DROP_UNUSABLE; |
1104 | } | 1105 | } |
@@ -1202,7 +1203,7 @@ ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx) | |||
1202 | if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce, | 1203 | if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce, |
1203 | skb->data + 24, skb->len - 24, | 1204 | skb->data + 24, skb->len - 24, |
1204 | mic) < 0 || | 1205 | mic) < 0 || |
1205 | memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) { | 1206 | crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) { |
1206 | key->u.aes_gmac.icverrors++; | 1207 | key->u.aes_gmac.icverrors++; |
1207 | return RX_DROP_UNUSABLE; | 1208 | return RX_DROP_UNUSABLE; |
1208 | } | 1209 | } |
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c index 06019dba4b10..bd88a9b80773 100644 --- a/net/mac802154/iface.c +++ b/net/mac802154/iface.c | |||
@@ -526,8 +526,6 @@ static void mac802154_wpan_free(struct net_device *dev) | |||
526 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); | 526 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
527 | 527 | ||
528 | mac802154_llsec_destroy(&sdata->sec); | 528 | mac802154_llsec_destroy(&sdata->sec); |
529 | |||
530 | free_netdev(dev); | ||
531 | } | 529 | } |
532 | 530 | ||
533 | static void ieee802154_if_setup(struct net_device *dev) | 531 | static void ieee802154_if_setup(struct net_device *dev) |
@@ -593,7 +591,8 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, | |||
593 | sdata->dev->dev_addr); | 591 | sdata->dev->dev_addr); |
594 | 592 | ||
595 | sdata->dev->header_ops = &mac802154_header_ops; | 593 | sdata->dev->header_ops = &mac802154_header_ops; |
596 | sdata->dev->destructor = mac802154_wpan_free; | 594 | sdata->dev->needs_free_netdev = true; |
595 | sdata->dev->priv_destructor = mac802154_wpan_free; | ||
597 | sdata->dev->netdev_ops = &mac802154_wpan_ops; | 596 | sdata->dev->netdev_ops = &mac802154_wpan_ops; |
598 | sdata->dev->ml_priv = &mac802154_mlme_wpan; | 597 | sdata->dev->ml_priv = &mac802154_mlme_wpan; |
599 | wpan_dev->promiscuous_mode = false; | 598 | wpan_dev->promiscuous_mode = false; |
@@ -608,7 +607,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, | |||
608 | 607 | ||
609 | break; | 608 | break; |
610 | case NL802154_IFTYPE_MONITOR: | 609 | case NL802154_IFTYPE_MONITOR: |
611 | sdata->dev->destructor = free_netdev; | 610 | sdata->dev->needs_free_netdev = true; |
612 | sdata->dev->netdev_ops = &mac802154_monitor_ops; | 611 | sdata->dev->netdev_ops = &mac802154_monitor_ops; |
613 | wpan_dev->promiscuous_mode = true; | 612 | wpan_dev->promiscuous_mode = true; |
614 | break; | 613 | break; |
diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c index 89193a634da4..04a3128adcf0 100644 --- a/net/openvswitch/vport-internal_dev.c +++ b/net/openvswitch/vport-internal_dev.c | |||
@@ -94,7 +94,6 @@ static void internal_dev_destructor(struct net_device *dev) | |||
94 | struct vport *vport = ovs_internal_dev_get_vport(dev); | 94 | struct vport *vport = ovs_internal_dev_get_vport(dev); |
95 | 95 | ||
96 | ovs_vport_free(vport); | 96 | ovs_vport_free(vport); |
97 | free_netdev(dev); | ||
98 | } | 97 | } |
99 | 98 | ||
100 | static void | 99 | static void |
@@ -156,7 +155,8 @@ static void do_setup(struct net_device *netdev) | |||
156 | netdev->priv_flags &= ~IFF_TX_SKB_SHARING; | 155 | netdev->priv_flags &= ~IFF_TX_SKB_SHARING; |
157 | netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH | | 156 | netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH | |
158 | IFF_PHONY_HEADROOM | IFF_NO_QUEUE; | 157 | IFF_PHONY_HEADROOM | IFF_NO_QUEUE; |
159 | netdev->destructor = internal_dev_destructor; | 158 | netdev->needs_free_netdev = true; |
159 | netdev->priv_destructor = internal_dev_destructor; | ||
160 | netdev->ethtool_ops = &internal_dev_ethtool_ops; | 160 | netdev->ethtool_ops = &internal_dev_ethtool_ops; |
161 | netdev->rtnl_link_ops = &internal_dev_link_ops; | 161 | netdev->rtnl_link_ops = &internal_dev_link_ops; |
162 | 162 | ||
diff --git a/net/phonet/pep-gprs.c b/net/phonet/pep-gprs.c index 21c28b51be94..2c9337946e30 100644 --- a/net/phonet/pep-gprs.c +++ b/net/phonet/pep-gprs.c | |||
@@ -236,7 +236,7 @@ static void gprs_setup(struct net_device *dev) | |||
236 | dev->tx_queue_len = 10; | 236 | dev->tx_queue_len = 10; |
237 | 237 | ||
238 | dev->netdev_ops = &gprs_netdev_ops; | 238 | dev->netdev_ops = &gprs_netdev_ops; |
239 | dev->destructor = free_netdev; | 239 | dev->needs_free_netdev = true; |
240 | } | 240 | } |
241 | 241 | ||
242 | /* | 242 | /* |
diff --git a/net/rxrpc/key.c b/net/rxrpc/key.c index 0a4e28477ad9..54369225766e 100644 --- a/net/rxrpc/key.c +++ b/net/rxrpc/key.c | |||
@@ -217,7 +217,7 @@ static int rxrpc_krb5_decode_principal(struct krb5_principal *princ, | |||
217 | unsigned int *_toklen) | 217 | unsigned int *_toklen) |
218 | { | 218 | { |
219 | const __be32 *xdr = *_xdr; | 219 | const __be32 *xdr = *_xdr; |
220 | unsigned int toklen = *_toklen, n_parts, loop, tmp; | 220 | unsigned int toklen = *_toklen, n_parts, loop, tmp, paddedlen; |
221 | 221 | ||
222 | /* there must be at least one name, and at least #names+1 length | 222 | /* there must be at least one name, and at least #names+1 length |
223 | * words */ | 223 | * words */ |
@@ -247,16 +247,16 @@ static int rxrpc_krb5_decode_principal(struct krb5_principal *princ, | |||
247 | toklen -= 4; | 247 | toklen -= 4; |
248 | if (tmp <= 0 || tmp > AFSTOKEN_STRING_MAX) | 248 | if (tmp <= 0 || tmp > AFSTOKEN_STRING_MAX) |
249 | return -EINVAL; | 249 | return -EINVAL; |
250 | if (tmp > toklen) | 250 | paddedlen = (tmp + 3) & ~3; |
251 | if (paddedlen > toklen) | ||
251 | return -EINVAL; | 252 | return -EINVAL; |
252 | princ->name_parts[loop] = kmalloc(tmp + 1, GFP_KERNEL); | 253 | princ->name_parts[loop] = kmalloc(tmp + 1, GFP_KERNEL); |
253 | if (!princ->name_parts[loop]) | 254 | if (!princ->name_parts[loop]) |
254 | return -ENOMEM; | 255 | return -ENOMEM; |
255 | memcpy(princ->name_parts[loop], xdr, tmp); | 256 | memcpy(princ->name_parts[loop], xdr, tmp); |
256 | princ->name_parts[loop][tmp] = 0; | 257 | princ->name_parts[loop][tmp] = 0; |
257 | tmp = (tmp + 3) & ~3; | 258 | toklen -= paddedlen; |
258 | toklen -= tmp; | 259 | xdr += paddedlen >> 2; |
259 | xdr += tmp >> 2; | ||
260 | } | 260 | } |
261 | 261 | ||
262 | if (toklen < 4) | 262 | if (toklen < 4) |
@@ -265,16 +265,16 @@ static int rxrpc_krb5_decode_principal(struct krb5_principal *princ, | |||
265 | toklen -= 4; | 265 | toklen -= 4; |
266 | if (tmp <= 0 || tmp > AFSTOKEN_K5_REALM_MAX) | 266 | if (tmp <= 0 || tmp > AFSTOKEN_K5_REALM_MAX) |
267 | return -EINVAL; | 267 | return -EINVAL; |
268 | if (tmp > toklen) | 268 | paddedlen = (tmp + 3) & ~3; |
269 | if (paddedlen > toklen) | ||
269 | return -EINVAL; | 270 | return -EINVAL; |
270 | princ->realm = kmalloc(tmp + 1, GFP_KERNEL); | 271 | princ->realm = kmalloc(tmp + 1, GFP_KERNEL); |
271 | if (!princ->realm) | 272 | if (!princ->realm) |
272 | return -ENOMEM; | 273 | return -ENOMEM; |
273 | memcpy(princ->realm, xdr, tmp); | 274 | memcpy(princ->realm, xdr, tmp); |
274 | princ->realm[tmp] = 0; | 275 | princ->realm[tmp] = 0; |
275 | tmp = (tmp + 3) & ~3; | 276 | toklen -= paddedlen; |
276 | toklen -= tmp; | 277 | xdr += paddedlen >> 2; |
277 | xdr += tmp >> 2; | ||
278 | 278 | ||
279 | _debug("%s/...@%s", princ->name_parts[0], princ->realm); | 279 | _debug("%s/...@%s", princ->name_parts[0], princ->realm); |
280 | 280 | ||
@@ -293,7 +293,7 @@ static int rxrpc_krb5_decode_tagged_data(struct krb5_tagged_data *td, | |||
293 | unsigned int *_toklen) | 293 | unsigned int *_toklen) |
294 | { | 294 | { |
295 | const __be32 *xdr = *_xdr; | 295 | const __be32 *xdr = *_xdr; |
296 | unsigned int toklen = *_toklen, len; | 296 | unsigned int toklen = *_toklen, len, paddedlen; |
297 | 297 | ||
298 | /* there must be at least one tag and one length word */ | 298 | /* there must be at least one tag and one length word */ |
299 | if (toklen <= 8) | 299 | if (toklen <= 8) |
@@ -307,15 +307,17 @@ static int rxrpc_krb5_decode_tagged_data(struct krb5_tagged_data *td, | |||
307 | toklen -= 8; | 307 | toklen -= 8; |
308 | if (len > max_data_size) | 308 | if (len > max_data_size) |
309 | return -EINVAL; | 309 | return -EINVAL; |
310 | paddedlen = (len + 3) & ~3; | ||
311 | if (paddedlen > toklen) | ||
312 | return -EINVAL; | ||
310 | td->data_len = len; | 313 | td->data_len = len; |
311 | 314 | ||
312 | if (len > 0) { | 315 | if (len > 0) { |
313 | td->data = kmemdup(xdr, len, GFP_KERNEL); | 316 | td->data = kmemdup(xdr, len, GFP_KERNEL); |
314 | if (!td->data) | 317 | if (!td->data) |
315 | return -ENOMEM; | 318 | return -ENOMEM; |
316 | len = (len + 3) & ~3; | 319 | toklen -= paddedlen; |
317 | toklen -= len; | 320 | xdr += paddedlen >> 2; |
318 | xdr += len >> 2; | ||
319 | } | 321 | } |
320 | 322 | ||
321 | _debug("tag %x len %x", td->tag, td->data_len); | 323 | _debug("tag %x len %x", td->tag, td->data_len); |
@@ -387,7 +389,7 @@ static int rxrpc_krb5_decode_ticket(u8 **_ticket, u16 *_tktlen, | |||
387 | const __be32 **_xdr, unsigned int *_toklen) | 389 | const __be32 **_xdr, unsigned int *_toklen) |
388 | { | 390 | { |
389 | const __be32 *xdr = *_xdr; | 391 | const __be32 *xdr = *_xdr; |
390 | unsigned int toklen = *_toklen, len; | 392 | unsigned int toklen = *_toklen, len, paddedlen; |
391 | 393 | ||
392 | /* there must be at least one length word */ | 394 | /* there must be at least one length word */ |
393 | if (toklen <= 4) | 395 | if (toklen <= 4) |
@@ -399,6 +401,9 @@ static int rxrpc_krb5_decode_ticket(u8 **_ticket, u16 *_tktlen, | |||
399 | toklen -= 4; | 401 | toklen -= 4; |
400 | if (len > AFSTOKEN_K5_TIX_MAX) | 402 | if (len > AFSTOKEN_K5_TIX_MAX) |
401 | return -EINVAL; | 403 | return -EINVAL; |
404 | paddedlen = (len + 3) & ~3; | ||
405 | if (paddedlen > toklen) | ||
406 | return -EINVAL; | ||
402 | *_tktlen = len; | 407 | *_tktlen = len; |
403 | 408 | ||
404 | _debug("ticket len %u", len); | 409 | _debug("ticket len %u", len); |
@@ -407,9 +412,8 @@ static int rxrpc_krb5_decode_ticket(u8 **_ticket, u16 *_tktlen, | |||
407 | *_ticket = kmemdup(xdr, len, GFP_KERNEL); | 412 | *_ticket = kmemdup(xdr, len, GFP_KERNEL); |
408 | if (!*_ticket) | 413 | if (!*_ticket) |
409 | return -ENOMEM; | 414 | return -ENOMEM; |
410 | len = (len + 3) & ~3; | 415 | toklen -= paddedlen; |
411 | toklen -= len; | 416 | xdr += paddedlen >> 2; |
412 | xdr += len >> 2; | ||
413 | } | 417 | } |
414 | 418 | ||
415 | *_xdr = xdr; | 419 | *_xdr = xdr; |
@@ -552,7 +556,7 @@ static int rxrpc_preparse_xdr(struct key_preparsed_payload *prep) | |||
552 | { | 556 | { |
553 | const __be32 *xdr = prep->data, *token; | 557 | const __be32 *xdr = prep->data, *token; |
554 | const char *cp; | 558 | const char *cp; |
555 | unsigned int len, tmp, loop, ntoken, toklen, sec_ix; | 559 | unsigned int len, paddedlen, loop, ntoken, toklen, sec_ix; |
556 | size_t datalen = prep->datalen; | 560 | size_t datalen = prep->datalen; |
557 | int ret; | 561 | int ret; |
558 | 562 | ||
@@ -578,22 +582,21 @@ static int rxrpc_preparse_xdr(struct key_preparsed_payload *prep) | |||
578 | if (len < 1 || len > AFSTOKEN_CELL_MAX) | 582 | if (len < 1 || len > AFSTOKEN_CELL_MAX) |
579 | goto not_xdr; | 583 | goto not_xdr; |
580 | datalen -= 4; | 584 | datalen -= 4; |
581 | tmp = (len + 3) & ~3; | 585 | paddedlen = (len + 3) & ~3; |
582 | if (tmp > datalen) | 586 | if (paddedlen > datalen) |
583 | goto not_xdr; | 587 | goto not_xdr; |
584 | 588 | ||
585 | cp = (const char *) xdr; | 589 | cp = (const char *) xdr; |
586 | for (loop = 0; loop < len; loop++) | 590 | for (loop = 0; loop < len; loop++) |
587 | if (!isprint(cp[loop])) | 591 | if (!isprint(cp[loop])) |
588 | goto not_xdr; | 592 | goto not_xdr; |
589 | if (len < tmp) | 593 | for (; loop < paddedlen; loop++) |
590 | for (; loop < tmp; loop++) | 594 | if (cp[loop]) |
591 | if (cp[loop]) | 595 | goto not_xdr; |
592 | goto not_xdr; | ||
593 | _debug("cellname: [%u/%u] '%*.*s'", | 596 | _debug("cellname: [%u/%u] '%*.*s'", |
594 | len, tmp, len, len, (const char *) xdr); | 597 | len, paddedlen, len, len, (const char *) xdr); |
595 | datalen -= tmp; | 598 | datalen -= paddedlen; |
596 | xdr += tmp >> 2; | 599 | xdr += paddedlen >> 2; |
597 | 600 | ||
598 | /* get the token count */ | 601 | /* get the token count */ |
599 | if (datalen < 12) | 602 | if (datalen < 12) |
@@ -614,10 +617,11 @@ static int rxrpc_preparse_xdr(struct key_preparsed_payload *prep) | |||
614 | sec_ix = ntohl(*xdr); | 617 | sec_ix = ntohl(*xdr); |
615 | datalen -= 4; | 618 | datalen -= 4; |
616 | _debug("token: [%x/%zx] %x", toklen, datalen, sec_ix); | 619 | _debug("token: [%x/%zx] %x", toklen, datalen, sec_ix); |
617 | if (toklen < 20 || toklen > datalen) | 620 | paddedlen = (toklen + 3) & ~3; |
621 | if (toklen < 20 || toklen > datalen || paddedlen > datalen) | ||
618 | goto not_xdr; | 622 | goto not_xdr; |
619 | datalen -= (toklen + 3) & ~3; | 623 | datalen -= paddedlen; |
620 | xdr += (toklen + 3) >> 2; | 624 | xdr += paddedlen >> 2; |
621 | 625 | ||
622 | } while (--loop > 0); | 626 | } while (--loop > 0); |
623 | 627 | ||
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 164b5ac094be..7dc5892671c8 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c | |||
@@ -94,8 +94,10 @@ static struct tcf_pedit_key_ex *tcf_pedit_keys_ex_parse(struct nlattr *nla, | |||
94 | k++; | 94 | k++; |
95 | } | 95 | } |
96 | 96 | ||
97 | if (n) | 97 | if (n) { |
98 | err = -EINVAL; | ||
98 | goto err_out; | 99 | goto err_out; |
100 | } | ||
99 | 101 | ||
100 | return keys_ex; | 102 | return keys_ex; |
101 | 103 | ||
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index f42008b29311..b062bc80c7cb 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -132,21 +132,21 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla, | |||
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
135 | spin_lock_bh(&police->tcf_lock); | ||
136 | if (est) { | 135 | if (est) { |
137 | err = gen_replace_estimator(&police->tcf_bstats, NULL, | 136 | err = gen_replace_estimator(&police->tcf_bstats, NULL, |
138 | &police->tcf_rate_est, | 137 | &police->tcf_rate_est, |
139 | &police->tcf_lock, | 138 | &police->tcf_lock, |
140 | NULL, est); | 139 | NULL, est); |
141 | if (err) | 140 | if (err) |
142 | goto failure_unlock; | 141 | goto failure; |
143 | } else if (tb[TCA_POLICE_AVRATE] && | 142 | } else if (tb[TCA_POLICE_AVRATE] && |
144 | (ret == ACT_P_CREATED || | 143 | (ret == ACT_P_CREATED || |
145 | !gen_estimator_active(&police->tcf_rate_est))) { | 144 | !gen_estimator_active(&police->tcf_rate_est))) { |
146 | err = -EINVAL; | 145 | err = -EINVAL; |
147 | goto failure_unlock; | 146 | goto failure; |
148 | } | 147 | } |
149 | 148 | ||
149 | spin_lock_bh(&police->tcf_lock); | ||
150 | /* No failure allowed after this point */ | 150 | /* No failure allowed after this point */ |
151 | police->tcfp_mtu = parm->mtu; | 151 | police->tcfp_mtu = parm->mtu; |
152 | if (police->tcfp_mtu == 0) { | 152 | if (police->tcfp_mtu == 0) { |
@@ -192,8 +192,6 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla, | |||
192 | 192 | ||
193 | return ret; | 193 | return ret; |
194 | 194 | ||
195 | failure_unlock: | ||
196 | spin_unlock_bh(&police->tcf_lock); | ||
197 | failure: | 195 | failure: |
198 | qdisc_put_rtab(P_tab); | 196 | qdisc_put_rtab(P_tab); |
199 | qdisc_put_rtab(R_tab); | 197 | qdisc_put_rtab(R_tab); |
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index 8c589230794f..3dcd0ecf3d99 100644 --- a/net/sctp/endpointola.c +++ b/net/sctp/endpointola.c | |||
@@ -275,6 +275,7 @@ static void sctp_endpoint_destroy(struct sctp_endpoint *ep) | |||
275 | if (sctp_sk(sk)->bind_hash) | 275 | if (sctp_sk(sk)->bind_hash) |
276 | sctp_put_port(sk); | 276 | sctp_put_port(sk); |
277 | 277 | ||
278 | sctp_sk(sk)->ep = NULL; | ||
278 | sock_put(sk); | 279 | sock_put(sk); |
279 | } | 280 | } |
280 | 281 | ||
diff --git a/net/sctp/sctp_diag.c b/net/sctp/sctp_diag.c index 048954eee984..9a647214a91e 100644 --- a/net/sctp/sctp_diag.c +++ b/net/sctp/sctp_diag.c | |||
@@ -278,7 +278,6 @@ out: | |||
278 | 278 | ||
279 | static int sctp_sock_dump(struct sock *sk, void *p) | 279 | static int sctp_sock_dump(struct sock *sk, void *p) |
280 | { | 280 | { |
281 | struct sctp_endpoint *ep = sctp_sk(sk)->ep; | ||
282 | struct sctp_comm_param *commp = p; | 281 | struct sctp_comm_param *commp = p; |
283 | struct sk_buff *skb = commp->skb; | 282 | struct sk_buff *skb = commp->skb; |
284 | struct netlink_callback *cb = commp->cb; | 283 | struct netlink_callback *cb = commp->cb; |
@@ -287,7 +286,9 @@ static int sctp_sock_dump(struct sock *sk, void *p) | |||
287 | int err = 0; | 286 | int err = 0; |
288 | 287 | ||
289 | lock_sock(sk); | 288 | lock_sock(sk); |
290 | list_for_each_entry(assoc, &ep->asocs, asocs) { | 289 | if (!sctp_sk(sk)->ep) |
290 | goto release; | ||
291 | list_for_each_entry(assoc, &sctp_sk(sk)->ep->asocs, asocs) { | ||
291 | if (cb->args[4] < cb->args[1]) | 292 | if (cb->args[4] < cb->args[1]) |
292 | goto next; | 293 | goto next; |
293 | 294 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index f16c8d97b7f3..3a8318e518f1 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -4622,13 +4622,13 @@ int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), | |||
4622 | 4622 | ||
4623 | for (head = sctp_ep_hashtable; hash < sctp_ep_hashsize; | 4623 | for (head = sctp_ep_hashtable; hash < sctp_ep_hashsize; |
4624 | hash++, head++) { | 4624 | hash++, head++) { |
4625 | read_lock(&head->lock); | 4625 | read_lock_bh(&head->lock); |
4626 | sctp_for_each_hentry(epb, &head->chain) { | 4626 | sctp_for_each_hentry(epb, &head->chain) { |
4627 | err = cb(sctp_ep(epb), p); | 4627 | err = cb(sctp_ep(epb), p); |
4628 | if (err) | 4628 | if (err) |
4629 | break; | 4629 | break; |
4630 | } | 4630 | } |
4631 | read_unlock(&head->lock); | 4631 | read_unlock_bh(&head->lock); |
4632 | } | 4632 | } |
4633 | 4633 | ||
4634 | return err; | 4634 | return err; |
@@ -4666,9 +4666,8 @@ int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *), | |||
4666 | if (err) | 4666 | if (err) |
4667 | return err; | 4667 | return err; |
4668 | 4668 | ||
4669 | sctp_transport_get_idx(net, &hti, pos); | 4669 | obj = sctp_transport_get_idx(net, &hti, pos + 1); |
4670 | obj = sctp_transport_get_next(net, &hti); | 4670 | for (; !IS_ERR_OR_NULL(obj); obj = sctp_transport_get_next(net, &hti)) { |
4671 | for (; obj && !IS_ERR(obj); obj = sctp_transport_get_next(net, &hti)) { | ||
4672 | struct sctp_transport *transport = obj; | 4671 | struct sctp_transport *transport = obj; |
4673 | 4672 | ||
4674 | if (!sctp_transport_hold(transport)) | 4673 | if (!sctp_transport_hold(transport)) |
diff --git a/net/tipc/msg.c b/net/tipc/msg.c index 312ef7de57d7..ab3087687a32 100644 --- a/net/tipc/msg.c +++ b/net/tipc/msg.c | |||
@@ -508,7 +508,7 @@ bool tipc_msg_reverse(u32 own_node, struct sk_buff **skb, int err) | |||
508 | } | 508 | } |
509 | 509 | ||
510 | if (skb_cloned(_skb) && | 510 | if (skb_cloned(_skb) && |
511 | pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_KERNEL)) | 511 | pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_ATOMIC)) |
512 | goto exit; | 512 | goto exit; |
513 | 513 | ||
514 | /* Now reverse the concerned fields */ | 514 | /* Now reverse the concerned fields */ |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 6a7fe7660551..1a0c961f4ffe 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -999,7 +999,8 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
999 | struct path path = { }; | 999 | struct path path = { }; |
1000 | 1000 | ||
1001 | err = -EINVAL; | 1001 | err = -EINVAL; |
1002 | if (sunaddr->sun_family != AF_UNIX) | 1002 | if (addr_len < offsetofend(struct sockaddr_un, sun_family) || |
1003 | sunaddr->sun_family != AF_UNIX) | ||
1003 | goto out; | 1004 | goto out; |
1004 | 1005 | ||
1005 | if (addr_len == sizeof(short)) { | 1006 | if (addr_len == sizeof(short)) { |
@@ -1110,6 +1111,10 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, | |||
1110 | unsigned int hash; | 1111 | unsigned int hash; |
1111 | int err; | 1112 | int err; |
1112 | 1113 | ||
1114 | err = -EINVAL; | ||
1115 | if (alen < offsetofend(struct sockaddr, sa_family)) | ||
1116 | goto out; | ||
1117 | |||
1113 | if (addr->sa_family != AF_UNSPEC) { | 1118 | if (addr->sa_family != AF_UNSPEC) { |
1114 | err = unix_mkname(sunaddr, alen, &hash); | 1119 | err = unix_mkname(sunaddr, alen, &hash); |
1115 | if (err < 0) | 1120 | if (err < 0) |
diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c index 1a4db6790e20..6cdb054484d6 100644 --- a/net/wireless/wext-core.c +++ b/net/wireless/wext-core.c | |||
@@ -914,13 +914,12 @@ int call_commit_handler(struct net_device *dev) | |||
914 | * Main IOCTl dispatcher. | 914 | * Main IOCTl dispatcher. |
915 | * Check the type of IOCTL and call the appropriate wrapper... | 915 | * Check the type of IOCTL and call the appropriate wrapper... |
916 | */ | 916 | */ |
917 | static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, | 917 | static int wireless_process_ioctl(struct net *net, struct iwreq *iwr, |
918 | unsigned int cmd, | 918 | unsigned int cmd, |
919 | struct iw_request_info *info, | 919 | struct iw_request_info *info, |
920 | wext_ioctl_func standard, | 920 | wext_ioctl_func standard, |
921 | wext_ioctl_func private) | 921 | wext_ioctl_func private) |
922 | { | 922 | { |
923 | struct iwreq *iwr = (struct iwreq *) ifr; | ||
924 | struct net_device *dev; | 923 | struct net_device *dev; |
925 | iw_handler handler; | 924 | iw_handler handler; |
926 | 925 | ||
@@ -928,7 +927,7 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, | |||
928 | * The copy_to/from_user() of ifr is also dealt with in there */ | 927 | * The copy_to/from_user() of ifr is also dealt with in there */ |
929 | 928 | ||
930 | /* Make sure the device exist */ | 929 | /* Make sure the device exist */ |
931 | if ((dev = __dev_get_by_name(net, ifr->ifr_name)) == NULL) | 930 | if ((dev = __dev_get_by_name(net, iwr->ifr_name)) == NULL) |
932 | return -ENODEV; | 931 | return -ENODEV; |
933 | 932 | ||
934 | /* A bunch of special cases, then the generic case... | 933 | /* A bunch of special cases, then the generic case... |
@@ -957,9 +956,6 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, | |||
957 | else if (private) | 956 | else if (private) |
958 | return private(dev, iwr, cmd, info, handler); | 957 | return private(dev, iwr, cmd, info, handler); |
959 | } | 958 | } |
960 | /* Old driver API : call driver ioctl handler */ | ||
961 | if (dev->netdev_ops->ndo_do_ioctl) | ||
962 | return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); | ||
963 | return -EOPNOTSUPP; | 959 | return -EOPNOTSUPP; |
964 | } | 960 | } |
965 | 961 | ||
@@ -977,7 +973,7 @@ static int wext_permission_check(unsigned int cmd) | |||
977 | } | 973 | } |
978 | 974 | ||
979 | /* entry point from dev ioctl */ | 975 | /* entry point from dev ioctl */ |
980 | static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr, | 976 | static int wext_ioctl_dispatch(struct net *net, struct iwreq *iwr, |
981 | unsigned int cmd, struct iw_request_info *info, | 977 | unsigned int cmd, struct iw_request_info *info, |
982 | wext_ioctl_func standard, | 978 | wext_ioctl_func standard, |
983 | wext_ioctl_func private) | 979 | wext_ioctl_func private) |
@@ -987,9 +983,9 @@ static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr, | |||
987 | if (ret) | 983 | if (ret) |
988 | return ret; | 984 | return ret; |
989 | 985 | ||
990 | dev_load(net, ifr->ifr_name); | 986 | dev_load(net, iwr->ifr_name); |
991 | rtnl_lock(); | 987 | rtnl_lock(); |
992 | ret = wireless_process_ioctl(net, ifr, cmd, info, standard, private); | 988 | ret = wireless_process_ioctl(net, iwr, cmd, info, standard, private); |
993 | rtnl_unlock(); | 989 | rtnl_unlock(); |
994 | 990 | ||
995 | return ret; | 991 | return ret; |
@@ -1039,18 +1035,18 @@ static int ioctl_standard_call(struct net_device * dev, | |||
1039 | } | 1035 | } |
1040 | 1036 | ||
1041 | 1037 | ||
1042 | int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, | 1038 | int wext_handle_ioctl(struct net *net, struct iwreq *iwr, unsigned int cmd, |
1043 | void __user *arg) | 1039 | void __user *arg) |
1044 | { | 1040 | { |
1045 | struct iw_request_info info = { .cmd = cmd, .flags = 0 }; | 1041 | struct iw_request_info info = { .cmd = cmd, .flags = 0 }; |
1046 | int ret; | 1042 | int ret; |
1047 | 1043 | ||
1048 | ret = wext_ioctl_dispatch(net, ifr, cmd, &info, | 1044 | ret = wext_ioctl_dispatch(net, iwr, cmd, &info, |
1049 | ioctl_standard_call, | 1045 | ioctl_standard_call, |
1050 | ioctl_private_call); | 1046 | ioctl_private_call); |
1051 | if (ret >= 0 && | 1047 | if (ret >= 0 && |
1052 | IW_IS_GET(cmd) && | 1048 | IW_IS_GET(cmd) && |
1053 | copy_to_user(arg, ifr, sizeof(struct iwreq))) | 1049 | copy_to_user(arg, iwr, sizeof(struct iwreq))) |
1054 | return -EFAULT; | 1050 | return -EFAULT; |
1055 | 1051 | ||
1056 | return ret; | 1052 | return ret; |
@@ -1107,7 +1103,7 @@ int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, | |||
1107 | info.cmd = cmd; | 1103 | info.cmd = cmd; |
1108 | info.flags = IW_REQUEST_FLAG_COMPAT; | 1104 | info.flags = IW_REQUEST_FLAG_COMPAT; |
1109 | 1105 | ||
1110 | ret = wext_ioctl_dispatch(net, (struct ifreq *) &iwr, cmd, &info, | 1106 | ret = wext_ioctl_dispatch(net, &iwr, cmd, &info, |
1111 | compat_standard_call, | 1107 | compat_standard_call, |
1112 | compat_private_call); | 1108 | compat_private_call); |
1113 | 1109 | ||