aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-06-05 06:19:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-06-05 06:19:04 -0400
commit4d3797d7e1861ac1af150a6189315786c5e1c820 (patch)
treeaa7eff5dc1e297e1560eaa85d1fac5735e0650c1 /net
parent844ce9f2044723a9da0f4bce588cca410e774d24 (diff)
parent5343a7f8be11951cb3095b91e8e4eb506cfacc0f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix timeouts with direct mode authentication in mac80211, from Stanislaw Gruszka. 2) Aggregation sessions can deadlock in ath9k, from Felix Fietkau. 3) Netfilter's xt_addrtype doesn't work with ipv6 due to route lookups creating undesirable cache entries, from Florian Westphal. 4) Fix netfilter's ipt_ULOG from generating non-NULL terminated strings. 5) Fix netdev transmit queue crashes in mac80211, from Johannes Berg. 6) Fix copy and paste error in 802.11 stack that broke reporting of 64-bit station tx statistics, from Felix Fietkau. 7) When qlge_probe fails, it leaks the netdev. Fix from Wei Yongjun. 8) SKB control block (where we store the IP options information, amongst other things) must be cleared properly otherwise ICMP sending can crash for IP tunnels. Fix from Eric Dumazet. 9) Verification of Energy Efficient Ether support was coded wrongly, the test was inversed. Fix from Giuseppe CAVALLARO. 10) TCP handles redirects improperly because the wrong flow key is used for the route lookup. From Michal Kubecek. 11) Don't interpret MSG_CMSG_COMPAT from userspace, fix from Andy Lutomirski. 12) The new AF_VSOCK was missing from the lockdep string table, fix from Federico Vaga. 13) be2net doesn't handle checksumming of IP fragments properly, from Somnath Kotur. 14) Fix several bugs in the device address list code that lead to crashes and other misbehaviors. From Jay Vosburgh. 15) Fix ipv6 segmentation handling of fragmented GRE tunnel traffic, from Pravin B Shalr. 16) Fix usage of stale policies in IPSEC layer, from Paul Moore. 17) Fix team driver dump of ports when there are a large number of them, from Jiri Pirko. 18) Fix softlockups in UDP ipv4 socket lookup causes by and error in the hlist_nulls_for_each_entry_rcu() macro. From Eric Dumazet. 19) Fix several regressions added by the high rate accuracy changes to the htb packet scheduler. From Eric Dumazet. 20) Fix DMA'ing onto the stack in esd_usb2 and peak_usb CAN drivers, from Olivier Sobrie and Marc Kleine-Budde. 21) Fix unremovable network devices due to missing route pointer installation in the per-device ipv6 address list entries. From Gao feng. 22) Apply the tg3 5719 DMA workaround on 5720 chips as well, otherwise we get stalls. From Nithin Sujir. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (68 commits) net_sched: htb: do not mix 1ns and 64ns time units net: fix sk_buff head without data area tg3: Add read dma workaround for 5720 net: ethernet: xilinx_emaclite: set protocol selector bits when writing ANAR bnx2x: Fix bridged GSO for 57710/57711 chips net: fec: add fallback to random MAC address bnx2x: fix TCP offload for tunneling ipv4 over ipv6 ipv6: assign rt6_info to inet6_ifaddr in init_loopback net/mlx4_core: Keep VF assigned MAC in the PF admin table net/mlx4_en: Handle unassigned VF MAC address correctly net/mlx4_core: Return -EPROBE_DEFER when a VF is probed before PF is sufficiently initialized net/mlx4_en: Fix adaptive moderation cq update net: can: peak_usb: Do not do dma on the stack net: can: esd_usb2: Do not do dma on the stack net: can: kvaser_usb: fix reception on "USBcan Pro" and "USBcan R" type hardware. net_sched: restore "overhead xxx" handling net: force a reload of first item in hlist_nulls_for_each_entry_rcu hyperv: Fix vlan_proto setting in netvsc_recv_callback() team: fix port list dump for big number of ports list: introduce list_first_entry_or_null ...
Diffstat (limited to 'net')
-rw-r--r--net/core/dev_addr_lists.c17
-rw-r--r--net/core/skbuff.c4
-rw-r--r--net/core/sock.c6
-rw-r--r--net/ipv4/ip_tunnel.c2
-rw-r--r--net/ipv4/netfilter/ipt_ULOG.c6
-rw-r--r--net/ipv4/route.c7
-rw-r--r--net/ipv6/addrconf.c6
-rw-r--r--net/ipv6/netfilter.c7
-rw-r--r--net/ipv6/proc.c2
-rw-r--r--net/ipv6/udp_offload.c20
-rw-r--r--net/key/af_key.c4
-rw-r--r--net/mac80211/iface.c44
-rw-r--r--net/mac80211/mlme.c12
-rw-r--r--net/netfilter/core.c2
-rw-r--r--net/netfilter/ipvs/ip_vs_core.c35
-rw-r--r--net/netfilter/ipvs/ip_vs_sh.c2
-rw-r--r--net/netfilter/xt_LOG.c2
-rw-r--r--net/netfilter/xt_addrtype.c27
-rw-r--r--net/netlink/af_netlink.c2
-rw-r--r--net/nfc/Makefile1
-rw-r--r--net/sched/act_police.c8
-rw-r--r--net/sched/sch_generic.c8
-rw-r--r--net/sched/sch_htb.c42
-rw-r--r--net/sched/sch_tbf.c8
-rw-r--r--net/socket.c33
-rw-r--r--net/wireless/nl80211.c2
-rw-r--r--net/wireless/sme.c3
-rw-r--r--net/xfrm/xfrm_policy.c3
-rw-r--r--net/xfrm/xfrm_user.c2
29 files changed, 227 insertions, 90 deletions
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
index c013f38482a1..6cda4e2c2132 100644
--- a/net/core/dev_addr_lists.c
+++ b/net/core/dev_addr_lists.c
@@ -39,6 +39,7 @@ static int __hw_addr_create_ex(struct netdev_hw_addr_list *list,
39 ha->refcount = 1; 39 ha->refcount = 1;
40 ha->global_use = global; 40 ha->global_use = global;
41 ha->synced = sync; 41 ha->synced = sync;
42 ha->sync_cnt = 0;
42 list_add_tail_rcu(&ha->list, &list->list); 43 list_add_tail_rcu(&ha->list, &list->list);
43 list->count++; 44 list->count++;
44 45
@@ -66,7 +67,7 @@ static int __hw_addr_add_ex(struct netdev_hw_addr_list *list,
66 } 67 }
67 if (sync) { 68 if (sync) {
68 if (ha->synced) 69 if (ha->synced)
69 return 0; 70 return -EEXIST;
70 else 71 else
71 ha->synced = true; 72 ha->synced = true;
72 } 73 }
@@ -139,10 +140,13 @@ static int __hw_addr_sync_one(struct netdev_hw_addr_list *to_list,
139 140
140 err = __hw_addr_add_ex(to_list, ha->addr, addr_len, ha->type, 141 err = __hw_addr_add_ex(to_list, ha->addr, addr_len, ha->type,
141 false, true); 142 false, true);
142 if (err) 143 if (err && err != -EEXIST)
143 return err; 144 return err;
144 ha->sync_cnt++; 145
145 ha->refcount++; 146 if (!err) {
147 ha->sync_cnt++;
148 ha->refcount++;
149 }
146 150
147 return 0; 151 return 0;
148} 152}
@@ -159,7 +163,8 @@ static void __hw_addr_unsync_one(struct netdev_hw_addr_list *to_list,
159 if (err) 163 if (err)
160 return; 164 return;
161 ha->sync_cnt--; 165 ha->sync_cnt--;
162 __hw_addr_del_entry(from_list, ha, false, true); 166 /* address on from list is not marked synced */
167 __hw_addr_del_entry(from_list, ha, false, false);
163} 168}
164 169
165static int __hw_addr_sync_multiple(struct netdev_hw_addr_list *to_list, 170static int __hw_addr_sync_multiple(struct netdev_hw_addr_list *to_list,
@@ -796,7 +801,7 @@ int dev_mc_sync_multiple(struct net_device *to, struct net_device *from)
796 return -EINVAL; 801 return -EINVAL;
797 802
798 netif_addr_lock_nested(to); 803 netif_addr_lock_nested(to);
799 err = __hw_addr_sync(&to->mc, &from->mc, to->addr_len); 804 err = __hw_addr_sync_multiple(&to->mc, &from->mc, to->addr_len);
800 if (!err) 805 if (!err)
801 __dev_set_rx_mode(to); 806 __dev_set_rx_mode(to);
802 netif_addr_unlock(to); 807 netif_addr_unlock(to);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index af9185d0be6a..cfd777bd6bd0 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -195,7 +195,7 @@ struct sk_buff *__alloc_skb_head(gfp_t gfp_mask, int node)
195 * the tail pointer in struct sk_buff! 195 * the tail pointer in struct sk_buff!
196 */ 196 */
197 memset(skb, 0, offsetof(struct sk_buff, tail)); 197 memset(skb, 0, offsetof(struct sk_buff, tail));
198 skb->data = NULL; 198 skb->head = NULL;
199 skb->truesize = sizeof(struct sk_buff); 199 skb->truesize = sizeof(struct sk_buff);
200 atomic_set(&skb->users, 1); 200 atomic_set(&skb->users, 1);
201 201
@@ -611,7 +611,7 @@ static void skb_release_head_state(struct sk_buff *skb)
611static void skb_release_all(struct sk_buff *skb) 611static void skb_release_all(struct sk_buff *skb)
612{ 612{
613 skb_release_head_state(skb); 613 skb_release_head_state(skb);
614 if (likely(skb->data)) 614 if (likely(skb->head))
615 skb_release_data(skb); 615 skb_release_data(skb);
616} 616}
617 617
diff --git a/net/core/sock.c b/net/core/sock.c
index 6ba327da79e1..88868a9d21da 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -210,7 +210,7 @@ static const char *const af_family_key_strings[AF_MAX+1] = {
210 "sk_lock-AF_TIPC" , "sk_lock-AF_BLUETOOTH", "sk_lock-IUCV" , 210 "sk_lock-AF_TIPC" , "sk_lock-AF_BLUETOOTH", "sk_lock-IUCV" ,
211 "sk_lock-AF_RXRPC" , "sk_lock-AF_ISDN" , "sk_lock-AF_PHONET" , 211 "sk_lock-AF_RXRPC" , "sk_lock-AF_ISDN" , "sk_lock-AF_PHONET" ,
212 "sk_lock-AF_IEEE802154", "sk_lock-AF_CAIF" , "sk_lock-AF_ALG" , 212 "sk_lock-AF_IEEE802154", "sk_lock-AF_CAIF" , "sk_lock-AF_ALG" ,
213 "sk_lock-AF_NFC" , "sk_lock-AF_MAX" 213 "sk_lock-AF_NFC" , "sk_lock-AF_VSOCK" , "sk_lock-AF_MAX"
214}; 214};
215static const char *const af_family_slock_key_strings[AF_MAX+1] = { 215static const char *const af_family_slock_key_strings[AF_MAX+1] = {
216 "slock-AF_UNSPEC", "slock-AF_UNIX" , "slock-AF_INET" , 216 "slock-AF_UNSPEC", "slock-AF_UNIX" , "slock-AF_INET" ,
@@ -226,7 +226,7 @@ static const char *const af_family_slock_key_strings[AF_MAX+1] = {
226 "slock-AF_TIPC" , "slock-AF_BLUETOOTH", "slock-AF_IUCV" , 226 "slock-AF_TIPC" , "slock-AF_BLUETOOTH", "slock-AF_IUCV" ,
227 "slock-AF_RXRPC" , "slock-AF_ISDN" , "slock-AF_PHONET" , 227 "slock-AF_RXRPC" , "slock-AF_ISDN" , "slock-AF_PHONET" ,
228 "slock-AF_IEEE802154", "slock-AF_CAIF" , "slock-AF_ALG" , 228 "slock-AF_IEEE802154", "slock-AF_CAIF" , "slock-AF_ALG" ,
229 "slock-AF_NFC" , "slock-AF_MAX" 229 "slock-AF_NFC" , "slock-AF_VSOCK" ,"slock-AF_MAX"
230}; 230};
231static const char *const af_family_clock_key_strings[AF_MAX+1] = { 231static const char *const af_family_clock_key_strings[AF_MAX+1] = {
232 "clock-AF_UNSPEC", "clock-AF_UNIX" , "clock-AF_INET" , 232 "clock-AF_UNSPEC", "clock-AF_UNIX" , "clock-AF_INET" ,
@@ -242,7 +242,7 @@ static const char *const af_family_clock_key_strings[AF_MAX+1] = {
242 "clock-AF_TIPC" , "clock-AF_BLUETOOTH", "clock-AF_IUCV" , 242 "clock-AF_TIPC" , "clock-AF_BLUETOOTH", "clock-AF_IUCV" ,
243 "clock-AF_RXRPC" , "clock-AF_ISDN" , "clock-AF_PHONET" , 243 "clock-AF_RXRPC" , "clock-AF_ISDN" , "clock-AF_PHONET" ,
244 "clock-AF_IEEE802154", "clock-AF_CAIF" , "clock-AF_ALG" , 244 "clock-AF_IEEE802154", "clock-AF_CAIF" , "clock-AF_ALG" ,
245 "clock-AF_NFC" , "clock-AF_MAX" 245 "clock-AF_NFC" , "clock-AF_VSOCK" , "clock-AF_MAX"
246}; 246};
247 247
248/* 248/*
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index e4147ec1665a..be2f8da0ae8e 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -503,6 +503,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
503 503
504 inner_iph = (const struct iphdr *)skb_inner_network_header(skb); 504 inner_iph = (const struct iphdr *)skb_inner_network_header(skb);
505 505
506 memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
506 dst = tnl_params->daddr; 507 dst = tnl_params->daddr;
507 if (dst == 0) { 508 if (dst == 0) {
508 /* NBMA tunnel */ 509 /* NBMA tunnel */
@@ -658,7 +659,6 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
658 659
659 skb_dst_drop(skb); 660 skb_dst_drop(skb);
660 skb_dst_set(skb, &rt->dst); 661 skb_dst_set(skb, &rt->dst);
661 memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
662 662
663 /* Push down and install the IP header. */ 663 /* Push down and install the IP header. */
664 skb_push(skb, sizeof(struct iphdr)); 664 skb_push(skb, sizeof(struct iphdr));
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index cf08218ddbcf..ff4b781b1056 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -231,8 +231,10 @@ static void ipt_ulog_packet(struct net *net,
231 put_unaligned(tv.tv_usec, &pm->timestamp_usec); 231 put_unaligned(tv.tv_usec, &pm->timestamp_usec);
232 put_unaligned(skb->mark, &pm->mark); 232 put_unaligned(skb->mark, &pm->mark);
233 pm->hook = hooknum; 233 pm->hook = hooknum;
234 if (prefix != NULL) 234 if (prefix != NULL) {
235 strncpy(pm->prefix, prefix, sizeof(pm->prefix)); 235 strncpy(pm->prefix, prefix, sizeof(pm->prefix) - 1);
236 pm->prefix[sizeof(pm->prefix) - 1] = '\0';
237 }
236 else if (loginfo->prefix[0] != '\0') 238 else if (loginfo->prefix[0] != '\0')
237 strncpy(pm->prefix, loginfo->prefix, sizeof(pm->prefix)); 239 strncpy(pm->prefix, loginfo->prefix, sizeof(pm->prefix));
238 else 240 else
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 550781a17b34..d35bbf0cf404 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -737,10 +737,15 @@ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buf
737{ 737{
738 struct rtable *rt; 738 struct rtable *rt;
739 struct flowi4 fl4; 739 struct flowi4 fl4;
740 const struct iphdr *iph = (const struct iphdr *) skb->data;
741 int oif = skb->dev->ifindex;
742 u8 tos = RT_TOS(iph->tos);
743 u8 prot = iph->protocol;
744 u32 mark = skb->mark;
740 745
741 rt = (struct rtable *) dst; 746 rt = (struct rtable *) dst;
742 747
743 ip_rt_build_flow_key(&fl4, sk, skb); 748 __build_flow_key(&fl4, sk, iph, oif, tos, prot, mark, 0);
744 __ip_do_redirect(rt, skb, &fl4, true); 749 __ip_do_redirect(rt, skb, &fl4, true);
745} 750}
746 751
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d1ab6ab29a55..1bbf744c2cc3 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1487,7 +1487,7 @@ static int ipv6_count_addresses(struct inet6_dev *idev)
1487} 1487}
1488 1488
1489int ipv6_chk_addr(struct net *net, const struct in6_addr *addr, 1489int ipv6_chk_addr(struct net *net, const struct in6_addr *addr,
1490 struct net_device *dev, int strict) 1490 const struct net_device *dev, int strict)
1491{ 1491{
1492 struct inet6_ifaddr *ifp; 1492 struct inet6_ifaddr *ifp;
1493 unsigned int hash = inet6_addr_hash(addr); 1493 unsigned int hash = inet6_addr_hash(addr);
@@ -2658,8 +2658,10 @@ static void init_loopback(struct net_device *dev)
2658 sp_rt = addrconf_dst_alloc(idev, &sp_ifa->addr, 0); 2658 sp_rt = addrconf_dst_alloc(idev, &sp_ifa->addr, 0);
2659 2659
2660 /* Failure cases are ignored */ 2660 /* Failure cases are ignored */
2661 if (!IS_ERR(sp_rt)) 2661 if (!IS_ERR(sp_rt)) {
2662 sp_ifa->rt = sp_rt;
2662 ip6_ins_rt(sp_rt); 2663 ip6_ins_rt(sp_rt);
2664 }
2663 } 2665 }
2664 read_unlock_bh(&idev->lock); 2666 read_unlock_bh(&idev->lock);
2665 } 2667 }
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index 72836f40b730..95f3f1da0d7f 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -10,6 +10,7 @@
10#include <linux/netfilter.h> 10#include <linux/netfilter.h>
11#include <linux/netfilter_ipv6.h> 11#include <linux/netfilter_ipv6.h>
12#include <linux/export.h> 12#include <linux/export.h>
13#include <net/addrconf.h>
13#include <net/dst.h> 14#include <net/dst.h>
14#include <net/ipv6.h> 15#include <net/ipv6.h>
15#include <net/ip6_route.h> 16#include <net/ip6_route.h>
@@ -186,6 +187,10 @@ static __sum16 nf_ip6_checksum_partial(struct sk_buff *skb, unsigned int hook,
186 return csum; 187 return csum;
187}; 188};
188 189
190static const struct nf_ipv6_ops ipv6ops = {
191 .chk_addr = ipv6_chk_addr,
192};
193
189static const struct nf_afinfo nf_ip6_afinfo = { 194static const struct nf_afinfo nf_ip6_afinfo = {
190 .family = AF_INET6, 195 .family = AF_INET6,
191 .checksum = nf_ip6_checksum, 196 .checksum = nf_ip6_checksum,
@@ -198,6 +203,7 @@ static const struct nf_afinfo nf_ip6_afinfo = {
198 203
199int __init ipv6_netfilter_init(void) 204int __init ipv6_netfilter_init(void)
200{ 205{
206 RCU_INIT_POINTER(nf_ipv6_ops, &ipv6ops);
201 return nf_register_afinfo(&nf_ip6_afinfo); 207 return nf_register_afinfo(&nf_ip6_afinfo);
202} 208}
203 209
@@ -206,5 +212,6 @@ int __init ipv6_netfilter_init(void)
206 */ 212 */
207void ipv6_netfilter_fini(void) 213void ipv6_netfilter_fini(void)
208{ 214{
215 RCU_INIT_POINTER(nf_ipv6_ops, NULL);
209 nf_unregister_afinfo(&nf_ip6_afinfo); 216 nf_unregister_afinfo(&nf_ip6_afinfo);
210} 217}
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index f3c1ff4357ff..51c3285b5d9b 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -90,7 +90,7 @@ static const struct snmp_mib snmp6_ipstats_list[] = {
90 SNMP_MIB_ITEM("Ip6OutMcastOctets", IPSTATS_MIB_OUTMCASTOCTETS), 90 SNMP_MIB_ITEM("Ip6OutMcastOctets", IPSTATS_MIB_OUTMCASTOCTETS),
91 SNMP_MIB_ITEM("Ip6InBcastOctets", IPSTATS_MIB_INBCASTOCTETS), 91 SNMP_MIB_ITEM("Ip6InBcastOctets", IPSTATS_MIB_INBCASTOCTETS),
92 SNMP_MIB_ITEM("Ip6OutBcastOctets", IPSTATS_MIB_OUTBCASTOCTETS), 92 SNMP_MIB_ITEM("Ip6OutBcastOctets", IPSTATS_MIB_OUTBCASTOCTETS),
93 SNMP_MIB_ITEM("InCsumErrors", IPSTATS_MIB_CSUMERRORS), 93 /* IPSTATS_MIB_CSUMERRORS is not relevant in IPv6 (no checksum) */
94 SNMP_MIB_SENTINEL 94 SNMP_MIB_SENTINEL
95}; 95};
96 96
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c
index 3bb3a891a424..d3cfaf9c7a08 100644
--- a/net/ipv6/udp_offload.c
+++ b/net/ipv6/udp_offload.c
@@ -46,11 +46,12 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
46 unsigned int mss; 46 unsigned int mss;
47 unsigned int unfrag_ip6hlen, unfrag_len; 47 unsigned int unfrag_ip6hlen, unfrag_len;
48 struct frag_hdr *fptr; 48 struct frag_hdr *fptr;
49 u8 *mac_start, *prevhdr; 49 u8 *packet_start, *prevhdr;
50 u8 nexthdr; 50 u8 nexthdr;
51 u8 frag_hdr_sz = sizeof(struct frag_hdr); 51 u8 frag_hdr_sz = sizeof(struct frag_hdr);
52 int offset; 52 int offset;
53 __wsum csum; 53 __wsum csum;
54 int tnl_hlen;
54 55
55 mss = skb_shinfo(skb)->gso_size; 56 mss = skb_shinfo(skb)->gso_size;
56 if (unlikely(skb->len <= mss)) 57 if (unlikely(skb->len <= mss))
@@ -83,9 +84,11 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
83 skb->ip_summed = CHECKSUM_NONE; 84 skb->ip_summed = CHECKSUM_NONE;
84 85
85 /* Check if there is enough headroom to insert fragment header. */ 86 /* Check if there is enough headroom to insert fragment header. */
86 if ((skb_mac_header(skb) < skb->head + frag_hdr_sz) && 87 tnl_hlen = skb_tnl_header_len(skb);
87 pskb_expand_head(skb, frag_hdr_sz, 0, GFP_ATOMIC)) 88 if (skb_headroom(skb) < (tnl_hlen + frag_hdr_sz)) {
88 goto out; 89 if (gso_pskb_expand_head(skb, tnl_hlen + frag_hdr_sz))
90 goto out;
91 }
89 92
90 /* Find the unfragmentable header and shift it left by frag_hdr_sz 93 /* Find the unfragmentable header and shift it left by frag_hdr_sz
91 * bytes to insert fragment header. 94 * bytes to insert fragment header.
@@ -93,11 +96,12 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
93 unfrag_ip6hlen = ip6_find_1stfragopt(skb, &prevhdr); 96 unfrag_ip6hlen = ip6_find_1stfragopt(skb, &prevhdr);
94 nexthdr = *prevhdr; 97 nexthdr = *prevhdr;
95 *prevhdr = NEXTHDR_FRAGMENT; 98 *prevhdr = NEXTHDR_FRAGMENT;
96 unfrag_len = skb_network_header(skb) - skb_mac_header(skb) + 99 unfrag_len = (skb_network_header(skb) - skb_mac_header(skb)) +
97 unfrag_ip6hlen; 100 unfrag_ip6hlen + tnl_hlen;
98 mac_start = skb_mac_header(skb); 101 packet_start = (u8 *) skb->head + SKB_GSO_CB(skb)->mac_offset;
99 memmove(mac_start-frag_hdr_sz, mac_start, unfrag_len); 102 memmove(packet_start-frag_hdr_sz, packet_start, unfrag_len);
100 103
104 SKB_GSO_CB(skb)->mac_offset -= frag_hdr_sz;
101 skb->mac_header -= frag_hdr_sz; 105 skb->mac_header -= frag_hdr_sz;
102 skb->network_header -= frag_hdr_sz; 106 skb->network_header -= frag_hdr_sz;
103 107
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 5b1e5af25713..c5fbd7589681 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2366,6 +2366,8 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, const struct sa
2366 2366
2367out: 2367out:
2368 xfrm_pol_put(xp); 2368 xfrm_pol_put(xp);
2369 if (err == 0)
2370 xfrm_garbage_collect(net);
2369 return err; 2371 return err;
2370} 2372}
2371 2373
@@ -2615,6 +2617,8 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, const struct sadb_
2615 2617
2616out: 2618out:
2617 xfrm_pol_put(xp); 2619 xfrm_pol_put(xp);
2620 if (delete && err == 0)
2621 xfrm_garbage_collect(net);
2618 return err; 2622 return err;
2619} 2623}
2620 2624
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 60f1ce5e5e52..98d20c0f6fed 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -159,9 +159,10 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
159 return 0; 159 return 0;
160} 160}
161 161
162static int ieee80211_verify_mac(struct ieee80211_local *local, u8 *addr) 162static int ieee80211_verify_mac(struct ieee80211_sub_if_data *sdata, u8 *addr)
163{ 163{
164 struct ieee80211_sub_if_data *sdata; 164 struct ieee80211_local *local = sdata->local;
165 struct ieee80211_sub_if_data *iter;
165 u64 new, mask, tmp; 166 u64 new, mask, tmp;
166 u8 *m; 167 u8 *m;
167 int ret = 0; 168 int ret = 0;
@@ -181,11 +182,14 @@ static int ieee80211_verify_mac(struct ieee80211_local *local, u8 *addr)
181 182
182 183
183 mutex_lock(&local->iflist_mtx); 184 mutex_lock(&local->iflist_mtx);
184 list_for_each_entry(sdata, &local->interfaces, list) { 185 list_for_each_entry(iter, &local->interfaces, list) {
185 if (sdata->vif.type == NL80211_IFTYPE_MONITOR) 186 if (iter == sdata)
187 continue;
188
189 if (iter->vif.type == NL80211_IFTYPE_MONITOR)
186 continue; 190 continue;
187 191
188 m = sdata->vif.addr; 192 m = iter->vif.addr;
189 tmp = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) | 193 tmp = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) |
190 ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) | 194 ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) |
191 ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8); 195 ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8);
@@ -209,7 +213,7 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr)
209 if (ieee80211_sdata_running(sdata)) 213 if (ieee80211_sdata_running(sdata))
210 return -EBUSY; 214 return -EBUSY;
211 215
212 ret = ieee80211_verify_mac(sdata->local, sa->sa_data); 216 ret = ieee80211_verify_mac(sdata, sa->sa_data);
213 if (ret) 217 if (ret)
214 return ret; 218 return ret;
215 219
@@ -474,6 +478,9 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
474 master->control_port_protocol; 478 master->control_port_protocol;
475 sdata->control_port_no_encrypt = 479 sdata->control_port_no_encrypt =
476 master->control_port_no_encrypt; 480 master->control_port_no_encrypt;
481 sdata->vif.cab_queue = master->vif.cab_queue;
482 memcpy(sdata->vif.hw_queue, master->vif.hw_queue,
483 sizeof(sdata->vif.hw_queue));
477 break; 484 break;
478 } 485 }
479 case NL80211_IFTYPE_AP: 486 case NL80211_IFTYPE_AP:
@@ -653,7 +660,11 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
653 660
654 ieee80211_recalc_ps(local, -1); 661 ieee80211_recalc_ps(local, -1);
655 662
656 if (dev) { 663 if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
664 sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
665 /* XXX: for AP_VLAN, actually track AP queues */
666 netif_tx_start_all_queues(dev);
667 } else if (dev) {
657 unsigned long flags; 668 unsigned long flags;
658 int n_acs = IEEE80211_NUM_ACS; 669 int n_acs = IEEE80211_NUM_ACS;
659 int ac; 670 int ac;
@@ -1479,7 +1490,17 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
1479 break; 1490 break;
1480 } 1491 }
1481 1492
1493 /*
1494 * Pick address of existing interface in case user changed
1495 * MAC address manually, default to perm_addr.
1496 */
1482 m = local->hw.wiphy->perm_addr; 1497 m = local->hw.wiphy->perm_addr;
1498 list_for_each_entry(sdata, &local->interfaces, list) {
1499 if (sdata->vif.type == NL80211_IFTYPE_MONITOR)
1500 continue;
1501 m = sdata->vif.addr;
1502 break;
1503 }
1483 start = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) | 1504 start = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) |
1484 ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) | 1505 ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) |
1485 ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8); 1506 ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8);
@@ -1696,6 +1717,15 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local)
1696 1717
1697 ASSERT_RTNL(); 1718 ASSERT_RTNL();
1698 1719
1720 /*
1721 * Close all AP_VLAN interfaces first, as otherwise they
1722 * might be closed while the AP interface they belong to
1723 * is closed, causing unregister_netdevice_many() to crash.
1724 */
1725 list_for_each_entry(sdata, &local->interfaces, list)
1726 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
1727 dev_close(sdata->dev);
1728
1699 mutex_lock(&local->iflist_mtx); 1729 mutex_lock(&local->iflist_mtx);
1700 list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { 1730 list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
1701 list_del(&sdata->list); 1731 list_del(&sdata->list);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a46e490f20dd..a8c2130c8ba4 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3321,10 +3321,6 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata)
3321 if (WARN_ON_ONCE(!auth_data)) 3321 if (WARN_ON_ONCE(!auth_data))
3322 return -EINVAL; 3322 return -EINVAL;
3323 3323
3324 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)
3325 tx_flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
3326 IEEE80211_TX_INTFL_MLME_CONN_TX;
3327
3328 auth_data->tries++; 3324 auth_data->tries++;
3329 3325
3330 if (auth_data->tries > IEEE80211_AUTH_MAX_TRIES) { 3326 if (auth_data->tries > IEEE80211_AUTH_MAX_TRIES) {
@@ -3358,6 +3354,10 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata)
3358 auth_data->expected_transaction = trans; 3354 auth_data->expected_transaction = trans;
3359 } 3355 }
3360 3356
3357 if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)
3358 tx_flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
3359 IEEE80211_TX_INTFL_MLME_CONN_TX;
3360
3361 ieee80211_send_auth(sdata, trans, auth_data->algorithm, status, 3361 ieee80211_send_auth(sdata, trans, auth_data->algorithm, status,
3362 auth_data->data, auth_data->data_len, 3362 auth_data->data, auth_data->data_len,
3363 auth_data->bss->bssid, 3363 auth_data->bss->bssid,
@@ -3381,12 +3381,12 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata)
3381 * will not answer to direct packet in unassociated state. 3381 * will not answer to direct packet in unassociated state.
3382 */ 3382 */
3383 ieee80211_send_probe_req(sdata, NULL, ssidie + 2, ssidie[1], 3383 ieee80211_send_probe_req(sdata, NULL, ssidie + 2, ssidie[1],
3384 NULL, 0, (u32) -1, true, tx_flags, 3384 NULL, 0, (u32) -1, true, 0,
3385 auth_data->bss->channel, false); 3385 auth_data->bss->channel, false);
3386 rcu_read_unlock(); 3386 rcu_read_unlock();
3387 } 3387 }
3388 3388
3389 if (!(local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)) { 3389 if (tx_flags == 0) {
3390 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; 3390 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT;
3391 ifmgd->auth_data->timeout_started = true; 3391 ifmgd->auth_data->timeout_started = true;
3392 run_again(ifmgd, auth_data->timeout); 3392 run_again(ifmgd, auth_data->timeout);
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 07c865a31a3d..857ca9f35177 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -30,6 +30,8 @@ static DEFINE_MUTEX(afinfo_mutex);
30 30
31const struct nf_afinfo __rcu *nf_afinfo[NFPROTO_NUMPROTO] __read_mostly; 31const struct nf_afinfo __rcu *nf_afinfo[NFPROTO_NUMPROTO] __read_mostly;
32EXPORT_SYMBOL(nf_afinfo); 32EXPORT_SYMBOL(nf_afinfo);
33const struct nf_ipv6_ops __rcu *nf_ipv6_ops __read_mostly;
34EXPORT_SYMBOL_GPL(nf_ipv6_ops);
33 35
34int nf_register_afinfo(const struct nf_afinfo *afinfo) 36int nf_register_afinfo(const struct nf_afinfo *afinfo)
35{ 37{
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 085b5880ab0d..05565d2b3a61 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1001,6 +1001,32 @@ static inline int is_tcp_reset(const struct sk_buff *skb, int nh_len)
1001 return th->rst; 1001 return th->rst;
1002} 1002}
1003 1003
1004static inline bool is_new_conn(const struct sk_buff *skb,
1005 struct ip_vs_iphdr *iph)
1006{
1007 switch (iph->protocol) {
1008 case IPPROTO_TCP: {
1009 struct tcphdr _tcph, *th;
1010
1011 th = skb_header_pointer(skb, iph->len, sizeof(_tcph), &_tcph);
1012 if (th == NULL)
1013 return false;
1014 return th->syn;
1015 }
1016 case IPPROTO_SCTP: {
1017 sctp_chunkhdr_t *sch, schunk;
1018
1019 sch = skb_header_pointer(skb, iph->len + sizeof(sctp_sctphdr_t),
1020 sizeof(schunk), &schunk);
1021 if (sch == NULL)
1022 return false;
1023 return sch->type == SCTP_CID_INIT;
1024 }
1025 default:
1026 return false;
1027 }
1028}
1029
1004/* Handle response packets: rewrite addresses and send away... 1030/* Handle response packets: rewrite addresses and send away...
1005 */ 1031 */
1006static unsigned int 1032static unsigned int
@@ -1612,6 +1638,15 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
1612 * Check if the packet belongs to an existing connection entry 1638 * Check if the packet belongs to an existing connection entry
1613 */ 1639 */
1614 cp = pp->conn_in_get(af, skb, &iph, 0); 1640 cp = pp->conn_in_get(af, skb, &iph, 0);
1641
1642 if (unlikely(sysctl_expire_nodest_conn(ipvs)) && cp && cp->dest &&
1643 unlikely(!atomic_read(&cp->dest->weight)) && !iph.fragoffs &&
1644 is_new_conn(skb, &iph)) {
1645 ip_vs_conn_expire_now(cp);
1646 __ip_vs_conn_put(cp);
1647 cp = NULL;
1648 }
1649
1615 if (unlikely(!cp) && !iph.fragoffs) { 1650 if (unlikely(!cp) && !iph.fragoffs) {
1616 /* No (second) fragments need to enter here, as nf_defrag_ipv6 1651 /* No (second) fragments need to enter here, as nf_defrag_ipv6
1617 * replayed fragment zero will already have created the cp 1652 * replayed fragment zero will already have created the cp
diff --git a/net/netfilter/ipvs/ip_vs_sh.c b/net/netfilter/ipvs/ip_vs_sh.c
index 0df269d7c99f..a65edfe4b16c 100644
--- a/net/netfilter/ipvs/ip_vs_sh.c
+++ b/net/netfilter/ipvs/ip_vs_sh.c
@@ -67,8 +67,8 @@ struct ip_vs_sh_bucket {
67#define IP_VS_SH_TAB_MASK (IP_VS_SH_TAB_SIZE - 1) 67#define IP_VS_SH_TAB_MASK (IP_VS_SH_TAB_SIZE - 1)
68 68
69struct ip_vs_sh_state { 69struct ip_vs_sh_state {
70 struct ip_vs_sh_bucket buckets[IP_VS_SH_TAB_SIZE];
71 struct rcu_head rcu_head; 70 struct rcu_head rcu_head;
71 struct ip_vs_sh_bucket buckets[IP_VS_SH_TAB_SIZE];
72}; 72};
73 73
74/* 74/*
diff --git a/net/netfilter/xt_LOG.c b/net/netfilter/xt_LOG.c
index 491c7d821a0b..5ab24843370a 100644
--- a/net/netfilter/xt_LOG.c
+++ b/net/netfilter/xt_LOG.c
@@ -737,7 +737,7 @@ static void dump_ipv6_packet(struct sbuff *m,
737 dump_sk_uid_gid(m, skb->sk); 737 dump_sk_uid_gid(m, skb->sk);
738 738
739 /* Max length: 16 "MARK=0xFFFFFFFF " */ 739 /* Max length: 16 "MARK=0xFFFFFFFF " */
740 if (!recurse && skb->mark) 740 if (recurse && skb->mark)
741 sb_add(m, "MARK=0x%x ", skb->mark); 741 sb_add(m, "MARK=0x%x ", skb->mark);
742} 742}
743 743
diff --git a/net/netfilter/xt_addrtype.c b/net/netfilter/xt_addrtype.c
index 49c5ff7f6dd6..68ff29f60867 100644
--- a/net/netfilter/xt_addrtype.c
+++ b/net/netfilter/xt_addrtype.c
@@ -22,6 +22,7 @@
22#include <net/ip6_fib.h> 22#include <net/ip6_fib.h>
23#endif 23#endif
24 24
25#include <linux/netfilter_ipv6.h>
25#include <linux/netfilter/xt_addrtype.h> 26#include <linux/netfilter/xt_addrtype.h>
26#include <linux/netfilter/x_tables.h> 27#include <linux/netfilter/x_tables.h>
27 28
@@ -33,12 +34,12 @@ MODULE_ALIAS("ip6t_addrtype");
33 34
34#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 35#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
35static u32 match_lookup_rt6(struct net *net, const struct net_device *dev, 36static u32 match_lookup_rt6(struct net *net, const struct net_device *dev,
36 const struct in6_addr *addr) 37 const struct in6_addr *addr, u16 mask)
37{ 38{
38 const struct nf_afinfo *afinfo; 39 const struct nf_afinfo *afinfo;
39 struct flowi6 flow; 40 struct flowi6 flow;
40 struct rt6_info *rt; 41 struct rt6_info *rt;
41 u32 ret; 42 u32 ret = 0;
42 int route_err; 43 int route_err;
43 44
44 memset(&flow, 0, sizeof(flow)); 45 memset(&flow, 0, sizeof(flow));
@@ -49,12 +50,19 @@ static u32 match_lookup_rt6(struct net *net, const struct net_device *dev,
49 rcu_read_lock(); 50 rcu_read_lock();
50 51
51 afinfo = nf_get_afinfo(NFPROTO_IPV6); 52 afinfo = nf_get_afinfo(NFPROTO_IPV6);
52 if (afinfo != NULL) 53 if (afinfo != NULL) {
54 const struct nf_ipv6_ops *v6ops;
55
56 if (dev && (mask & XT_ADDRTYPE_LOCAL)) {
57 v6ops = nf_get_ipv6_ops();
58 if (v6ops && v6ops->chk_addr(net, addr, dev, true))
59 ret = XT_ADDRTYPE_LOCAL;
60 }
53 route_err = afinfo->route(net, (struct dst_entry **)&rt, 61 route_err = afinfo->route(net, (struct dst_entry **)&rt,
54 flowi6_to_flowi(&flow), !!dev); 62 flowi6_to_flowi(&flow), false);
55 else 63 } else {
56 route_err = 1; 64 route_err = 1;
57 65 }
58 rcu_read_unlock(); 66 rcu_read_unlock();
59 67
60 if (route_err) 68 if (route_err)
@@ -62,15 +70,12 @@ static u32 match_lookup_rt6(struct net *net, const struct net_device *dev,
62 70
63 if (rt->rt6i_flags & RTF_REJECT) 71 if (rt->rt6i_flags & RTF_REJECT)
64 ret = XT_ADDRTYPE_UNREACHABLE; 72 ret = XT_ADDRTYPE_UNREACHABLE;
65 else
66 ret = 0;
67 73
68 if (rt->rt6i_flags & RTF_LOCAL) 74 if (dev == NULL && rt->rt6i_flags & RTF_LOCAL)
69 ret |= XT_ADDRTYPE_LOCAL; 75 ret |= XT_ADDRTYPE_LOCAL;
70 if (rt->rt6i_flags & RTF_ANYCAST) 76 if (rt->rt6i_flags & RTF_ANYCAST)
71 ret |= XT_ADDRTYPE_ANYCAST; 77 ret |= XT_ADDRTYPE_ANYCAST;
72 78
73
74 dst_release(&rt->dst); 79 dst_release(&rt->dst);
75 return ret; 80 return ret;
76} 81}
@@ -90,7 +95,7 @@ static bool match_type6(struct net *net, const struct net_device *dev,
90 95
91 if ((XT_ADDRTYPE_LOCAL | XT_ADDRTYPE_ANYCAST | 96 if ((XT_ADDRTYPE_LOCAL | XT_ADDRTYPE_ANYCAST |
92 XT_ADDRTYPE_UNREACHABLE) & mask) 97 XT_ADDRTYPE_UNREACHABLE) & mask)
93 return !!(mask & match_lookup_rt6(net, dev, addr)); 98 return !!(mask & match_lookup_rt6(net, dev, addr, mask));
94 return true; 99 return true;
95} 100}
96 101
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 12ac6b47a35c..d0b3dd60d386 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -747,7 +747,7 @@ static void netlink_skb_destructor(struct sk_buff *skb)
747 atomic_dec(&ring->pending); 747 atomic_dec(&ring->pending);
748 sock_put(sk); 748 sock_put(sk);
749 749
750 skb->data = NULL; 750 skb->head = NULL;
751 } 751 }
752#endif 752#endif
753 if (skb->sk != NULL) 753 if (skb->sk != NULL)
diff --git a/net/nfc/Makefile b/net/nfc/Makefile
index fb799deaed4f..a76f4533cb6c 100644
--- a/net/nfc/Makefile
+++ b/net/nfc/Makefile
@@ -5,7 +5,6 @@
5obj-$(CONFIG_NFC) += nfc.o 5obj-$(CONFIG_NFC) += nfc.o
6obj-$(CONFIG_NFC_NCI) += nci/ 6obj-$(CONFIG_NFC_NCI) += nci/
7obj-$(CONFIG_NFC_HCI) += hci/ 7obj-$(CONFIG_NFC_HCI) += hci/
8#obj-$(CONFIG_NFC_LLCP) += llcp/
9 8
10nfc-objs := core.o netlink.o af_nfc.o rawsock.o llcp_core.o llcp_commands.o \ 9nfc-objs := core.o netlink.o af_nfc.o rawsock.o llcp_core.o llcp_commands.o \
11 llcp_sock.o 10 llcp_sock.o
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 823463adbd21..189e3c5b3d09 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -231,14 +231,14 @@ override:
231 } 231 }
232 if (R_tab) { 232 if (R_tab) {
233 police->rate_present = true; 233 police->rate_present = true;
234 psched_ratecfg_precompute(&police->rate, R_tab->rate.rate); 234 psched_ratecfg_precompute(&police->rate, &R_tab->rate);
235 qdisc_put_rtab(R_tab); 235 qdisc_put_rtab(R_tab);
236 } else { 236 } else {
237 police->rate_present = false; 237 police->rate_present = false;
238 } 238 }
239 if (P_tab) { 239 if (P_tab) {
240 police->peak_present = true; 240 police->peak_present = true;
241 psched_ratecfg_precompute(&police->peak, P_tab->rate.rate); 241 psched_ratecfg_precompute(&police->peak, &P_tab->rate);
242 qdisc_put_rtab(P_tab); 242 qdisc_put_rtab(P_tab);
243 } else { 243 } else {
244 police->peak_present = false; 244 police->peak_present = false;
@@ -376,9 +376,9 @@ tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
376 }; 376 };
377 377
378 if (police->rate_present) 378 if (police->rate_present)
379 opt.rate.rate = psched_ratecfg_getrate(&police->rate); 379 psched_ratecfg_getrate(&opt.rate, &police->rate);
380 if (police->peak_present) 380 if (police->peak_present)
381 opt.peakrate.rate = psched_ratecfg_getrate(&police->peak); 381 psched_ratecfg_getrate(&opt.peakrate, &police->peak);
382 if (nla_put(skb, TCA_POLICE_TBF, sizeof(opt), &opt)) 382 if (nla_put(skb, TCA_POLICE_TBF, sizeof(opt), &opt))
383 goto nla_put_failure; 383 goto nla_put_failure;
384 if (police->tcfp_result && 384 if (police->tcfp_result &&
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index eac7e0ee23c1..20224086cc28 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -898,14 +898,16 @@ void dev_shutdown(struct net_device *dev)
898 WARN_ON(timer_pending(&dev->watchdog_timer)); 898 WARN_ON(timer_pending(&dev->watchdog_timer));
899} 899}
900 900
901void psched_ratecfg_precompute(struct psched_ratecfg *r, u32 rate) 901void psched_ratecfg_precompute(struct psched_ratecfg *r,
902 const struct tc_ratespec *conf)
902{ 903{
903 u64 factor; 904 u64 factor;
904 u64 mult; 905 u64 mult;
905 int shift; 906 int shift;
906 907
907 r->rate_bps = (u64)rate << 3; 908 memset(r, 0, sizeof(*r));
908 r->shift = 0; 909 r->overhead = conf->overhead;
910 r->rate_bps = (u64)conf->rate << 3;
909 r->mult = 1; 911 r->mult = 1;
910 /* 912 /*
911 * Calibrate mult, shift so that token counting is accurate 913 * Calibrate mult, shift so that token counting is accurate
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 79b1876b6cd2..adaedd79389c 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -109,7 +109,7 @@ struct htb_class {
109 } un; 109 } un;
110 struct rb_node node[TC_HTB_NUMPRIO]; /* node for self or feed tree */ 110 struct rb_node node[TC_HTB_NUMPRIO]; /* node for self or feed tree */
111 struct rb_node pq_node; /* node for event queue */ 111 struct rb_node pq_node; /* node for event queue */
112 psched_time_t pq_key; 112 s64 pq_key;
113 113
114 int prio_activity; /* for which prios are we active */ 114 int prio_activity; /* for which prios are we active */
115 enum htb_cmode cmode; /* current mode of the class */ 115 enum htb_cmode cmode; /* current mode of the class */
@@ -121,10 +121,10 @@ struct htb_class {
121 /* token bucket parameters */ 121 /* token bucket parameters */
122 struct psched_ratecfg rate; 122 struct psched_ratecfg rate;
123 struct psched_ratecfg ceil; 123 struct psched_ratecfg ceil;
124 s64 buffer, cbuffer; /* token bucket depth/rate */ 124 s64 buffer, cbuffer; /* token bucket depth/rate */
125 psched_tdiff_t mbuffer; /* max wait time */ 125 s64 mbuffer; /* max wait time */
126 s64 tokens, ctokens; /* current number of tokens */ 126 s64 tokens, ctokens; /* current number of tokens */
127 psched_time_t t_c; /* checkpoint time */ 127 s64 t_c; /* checkpoint time */
128}; 128};
129 129
130struct htb_sched { 130struct htb_sched {
@@ -141,15 +141,15 @@ struct htb_sched {
141 struct rb_root wait_pq[TC_HTB_MAXDEPTH]; 141 struct rb_root wait_pq[TC_HTB_MAXDEPTH];
142 142
143 /* time of nearest event per level (row) */ 143 /* time of nearest event per level (row) */
144 psched_time_t near_ev_cache[TC_HTB_MAXDEPTH]; 144 s64 near_ev_cache[TC_HTB_MAXDEPTH];
145 145
146 int defcls; /* class where unclassified flows go to */ 146 int defcls; /* class where unclassified flows go to */
147 147
148 /* filters for qdisc itself */ 148 /* filters for qdisc itself */
149 struct tcf_proto *filter_list; 149 struct tcf_proto *filter_list;
150 150
151 int rate2quantum; /* quant = rate / rate2quantum */ 151 int rate2quantum; /* quant = rate / rate2quantum */
152 psched_time_t now; /* cached dequeue time */ 152 s64 now; /* cached dequeue time */
153 struct qdisc_watchdog watchdog; 153 struct qdisc_watchdog watchdog;
154 154
155 /* non shaped skbs; let them go directly thru */ 155 /* non shaped skbs; let them go directly thru */
@@ -664,8 +664,8 @@ static void htb_charge_class(struct htb_sched *q, struct htb_class *cl,
664 * next pending event (0 for no event in pq, q->now for too many events). 664 * next pending event (0 for no event in pq, q->now for too many events).
665 * Note: Applied are events whose have cl->pq_key <= q->now. 665 * Note: Applied are events whose have cl->pq_key <= q->now.
666 */ 666 */
667static psched_time_t htb_do_events(struct htb_sched *q, int level, 667static s64 htb_do_events(struct htb_sched *q, int level,
668 unsigned long start) 668 unsigned long start)
669{ 669{
670 /* don't run for longer than 2 jiffies; 2 is used instead of 670 /* don't run for longer than 2 jiffies; 2 is used instead of
671 * 1 to simplify things when jiffy is going to be incremented 671 * 1 to simplify things when jiffy is going to be incremented
@@ -857,7 +857,7 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch)
857 struct sk_buff *skb; 857 struct sk_buff *skb;
858 struct htb_sched *q = qdisc_priv(sch); 858 struct htb_sched *q = qdisc_priv(sch);
859 int level; 859 int level;
860 psched_time_t next_event; 860 s64 next_event;
861 unsigned long start_at; 861 unsigned long start_at;
862 862
863 /* try to dequeue direct packets as high prio (!) to minimize cpu work */ 863 /* try to dequeue direct packets as high prio (!) to minimize cpu work */
@@ -880,7 +880,7 @@ ok:
880 for (level = 0; level < TC_HTB_MAXDEPTH; level++) { 880 for (level = 0; level < TC_HTB_MAXDEPTH; level++) {
881 /* common case optimization - skip event handler quickly */ 881 /* common case optimization - skip event handler quickly */
882 int m; 882 int m;
883 psched_time_t event; 883 s64 event;
884 884
885 if (q->now >= q->near_ev_cache[level]) { 885 if (q->now >= q->near_ev_cache[level]) {
886 event = htb_do_events(q, level, start_at); 886 event = htb_do_events(q, level, start_at);
@@ -1090,9 +1090,9 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg,
1090 1090
1091 memset(&opt, 0, sizeof(opt)); 1091 memset(&opt, 0, sizeof(opt));
1092 1092
1093 opt.rate.rate = psched_ratecfg_getrate(&cl->rate); 1093 psched_ratecfg_getrate(&opt.rate, &cl->rate);
1094 opt.buffer = PSCHED_NS2TICKS(cl->buffer); 1094 opt.buffer = PSCHED_NS2TICKS(cl->buffer);
1095 opt.ceil.rate = psched_ratecfg_getrate(&cl->ceil); 1095 psched_ratecfg_getrate(&opt.ceil, &cl->ceil);
1096 opt.cbuffer = PSCHED_NS2TICKS(cl->cbuffer); 1096 opt.cbuffer = PSCHED_NS2TICKS(cl->cbuffer);
1097 opt.quantum = cl->quantum; 1097 opt.quantum = cl->quantum;
1098 opt.prio = cl->prio; 1098 opt.prio = cl->prio;
@@ -1117,8 +1117,8 @@ htb_dump_class_stats(struct Qdisc *sch, unsigned long arg, struct gnet_dump *d)
1117 1117
1118 if (!cl->level && cl->un.leaf.q) 1118 if (!cl->level && cl->un.leaf.q)
1119 cl->qstats.qlen = cl->un.leaf.q->q.qlen; 1119 cl->qstats.qlen = cl->un.leaf.q->q.qlen;
1120 cl->xstats.tokens = cl->tokens; 1120 cl->xstats.tokens = PSCHED_NS2TICKS(cl->tokens);
1121 cl->xstats.ctokens = cl->ctokens; 1121 cl->xstats.ctokens = PSCHED_NS2TICKS(cl->ctokens);
1122 1122
1123 if (gnet_stats_copy_basic(d, &cl->bstats) < 0 || 1123 if (gnet_stats_copy_basic(d, &cl->bstats) < 0 ||
1124 gnet_stats_copy_rate_est(d, NULL, &cl->rate_est) < 0 || 1124 gnet_stats_copy_rate_est(d, NULL, &cl->rate_est) < 0 ||
@@ -1200,7 +1200,7 @@ static void htb_parent_to_leaf(struct htb_sched *q, struct htb_class *cl,
1200 parent->un.leaf.q = new_q ? new_q : &noop_qdisc; 1200 parent->un.leaf.q = new_q ? new_q : &noop_qdisc;
1201 parent->tokens = parent->buffer; 1201 parent->tokens = parent->buffer;
1202 parent->ctokens = parent->cbuffer; 1202 parent->ctokens = parent->cbuffer;
1203 parent->t_c = psched_get_time(); 1203 parent->t_c = ktime_to_ns(ktime_get());
1204 parent->cmode = HTB_CAN_SEND; 1204 parent->cmode = HTB_CAN_SEND;
1205} 1205}
1206 1206
@@ -1417,8 +1417,8 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
1417 /* set class to be in HTB_CAN_SEND state */ 1417 /* set class to be in HTB_CAN_SEND state */
1418 cl->tokens = PSCHED_TICKS2NS(hopt->buffer); 1418 cl->tokens = PSCHED_TICKS2NS(hopt->buffer);
1419 cl->ctokens = PSCHED_TICKS2NS(hopt->cbuffer); 1419 cl->ctokens = PSCHED_TICKS2NS(hopt->cbuffer);
1420 cl->mbuffer = 60 * PSCHED_TICKS_PER_SEC; /* 1min */ 1420 cl->mbuffer = 60ULL * NSEC_PER_SEC; /* 1min */
1421 cl->t_c = psched_get_time(); 1421 cl->t_c = ktime_to_ns(ktime_get());
1422 cl->cmode = HTB_CAN_SEND; 1422 cl->cmode = HTB_CAN_SEND;
1423 1423
1424 /* attach to the hash list and parent's family */ 1424 /* attach to the hash list and parent's family */
@@ -1459,8 +1459,8 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
1459 cl->prio = TC_HTB_NUMPRIO - 1; 1459 cl->prio = TC_HTB_NUMPRIO - 1;
1460 } 1460 }
1461 1461
1462 psched_ratecfg_precompute(&cl->rate, hopt->rate.rate); 1462 psched_ratecfg_precompute(&cl->rate, &hopt->rate);
1463 psched_ratecfg_precompute(&cl->ceil, hopt->ceil.rate); 1463 psched_ratecfg_precompute(&cl->ceil, &hopt->ceil);
1464 1464
1465 cl->buffer = PSCHED_TICKS2NS(hopt->buffer); 1465 cl->buffer = PSCHED_TICKS2NS(hopt->buffer);
1466 cl->cbuffer = PSCHED_TICKS2NS(hopt->buffer); 1466 cl->cbuffer = PSCHED_TICKS2NS(hopt->buffer);
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index c8388f3c3426..e478d316602b 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -298,9 +298,9 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt)
298 q->tokens = q->buffer; 298 q->tokens = q->buffer;
299 q->ptokens = q->mtu; 299 q->ptokens = q->mtu;
300 300
301 psched_ratecfg_precompute(&q->rate, rtab->rate.rate); 301 psched_ratecfg_precompute(&q->rate, &rtab->rate);
302 if (ptab) { 302 if (ptab) {
303 psched_ratecfg_precompute(&q->peak, ptab->rate.rate); 303 psched_ratecfg_precompute(&q->peak, &ptab->rate);
304 q->peak_present = true; 304 q->peak_present = true;
305 } else { 305 } else {
306 q->peak_present = false; 306 q->peak_present = false;
@@ -350,9 +350,9 @@ static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
350 goto nla_put_failure; 350 goto nla_put_failure;
351 351
352 opt.limit = q->limit; 352 opt.limit = q->limit;
353 opt.rate.rate = psched_ratecfg_getrate(&q->rate); 353 psched_ratecfg_getrate(&opt.rate, &q->rate);
354 if (q->peak_present) 354 if (q->peak_present)
355 opt.peakrate.rate = psched_ratecfg_getrate(&q->peak); 355 psched_ratecfg_getrate(&opt.peakrate, &q->peak);
356 else 356 else
357 memset(&opt.peakrate, 0, sizeof(opt.peakrate)); 357 memset(&opt.peakrate, 0, sizeof(opt.peakrate));
358 opt.mtu = PSCHED_NS2TICKS(q->mtu); 358 opt.mtu = PSCHED_NS2TICKS(q->mtu);
diff --git a/net/socket.c b/net/socket.c
index 6b94633ca61d..9ff6366fee13 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2075,8 +2075,12 @@ SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned int, fla
2075{ 2075{
2076 int fput_needed, err; 2076 int fput_needed, err;
2077 struct msghdr msg_sys; 2077 struct msghdr msg_sys;
2078 struct socket *sock = sockfd_lookup_light(fd, &err, &fput_needed); 2078 struct socket *sock;
2079
2080 if (flags & MSG_CMSG_COMPAT)
2081 return -EINVAL;
2079 2082
2083 sock = sockfd_lookup_light(fd, &err, &fput_needed);
2080 if (!sock) 2084 if (!sock)
2081 goto out; 2085 goto out;
2082 2086
@@ -2149,6 +2153,8 @@ int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
2149SYSCALL_DEFINE4(sendmmsg, int, fd, struct mmsghdr __user *, mmsg, 2153SYSCALL_DEFINE4(sendmmsg, int, fd, struct mmsghdr __user *, mmsg,
2150 unsigned int, vlen, unsigned int, flags) 2154 unsigned int, vlen, unsigned int, flags)
2151{ 2155{
2156 if (flags & MSG_CMSG_COMPAT)
2157 return -EINVAL;
2152 return __sys_sendmmsg(fd, mmsg, vlen, flags); 2158 return __sys_sendmmsg(fd, mmsg, vlen, flags);
2153} 2159}
2154 2160
@@ -2249,8 +2255,12 @@ SYSCALL_DEFINE3(recvmsg, int, fd, struct msghdr __user *, msg,
2249{ 2255{
2250 int fput_needed, err; 2256 int fput_needed, err;
2251 struct msghdr msg_sys; 2257 struct msghdr msg_sys;
2252 struct socket *sock = sockfd_lookup_light(fd, &err, &fput_needed); 2258 struct socket *sock;
2259
2260 if (flags & MSG_CMSG_COMPAT)
2261 return -EINVAL;
2253 2262
2263 sock = sockfd_lookup_light(fd, &err, &fput_needed);
2254 if (!sock) 2264 if (!sock)
2255 goto out; 2265 goto out;
2256 2266
@@ -2375,6 +2385,9 @@ SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg,
2375 int datagrams; 2385 int datagrams;
2376 struct timespec timeout_sys; 2386 struct timespec timeout_sys;
2377 2387
2388 if (flags & MSG_CMSG_COMPAT)
2389 return -EINVAL;
2390
2378 if (!timeout) 2391 if (!timeout)
2379 return __sys_recvmmsg(fd, mmsg, vlen, flags, NULL); 2392 return __sys_recvmmsg(fd, mmsg, vlen, flags, NULL);
2380 2393
@@ -2492,15 +2505,31 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args)
2492 (int __user *)a[4]); 2505 (int __user *)a[4]);
2493 break; 2506 break;
2494 case SYS_SENDMSG: 2507 case SYS_SENDMSG:
2508 if (a[2] & MSG_CMSG_COMPAT) {
2509 err = -EINVAL;
2510 break;
2511 }
2495 err = sys_sendmsg(a0, (struct msghdr __user *)a1, a[2]); 2512 err = sys_sendmsg(a0, (struct msghdr __user *)a1, a[2]);
2496 break; 2513 break;
2497 case SYS_SENDMMSG: 2514 case SYS_SENDMMSG:
2515 if (a[3] & MSG_CMSG_COMPAT) {
2516 err = -EINVAL;
2517 break;
2518 }
2498 err = sys_sendmmsg(a0, (struct mmsghdr __user *)a1, a[2], a[3]); 2519 err = sys_sendmmsg(a0, (struct mmsghdr __user *)a1, a[2], a[3]);
2499 break; 2520 break;
2500 case SYS_RECVMSG: 2521 case SYS_RECVMSG:
2522 if (a[2] & MSG_CMSG_COMPAT) {
2523 err = -EINVAL;
2524 break;
2525 }
2501 err = sys_recvmsg(a0, (struct msghdr __user *)a1, a[2]); 2526 err = sys_recvmsg(a0, (struct msghdr __user *)a1, a[2]);
2502 break; 2527 break;
2503 case SYS_RECVMMSG: 2528 case SYS_RECVMMSG:
2529 if (a[3] & MSG_CMSG_COMPAT) {
2530 err = -EINVAL;
2531 break;
2532 }
2504 err = sys_recvmmsg(a0, (struct mmsghdr __user *)a1, a[2], a[3], 2533 err = sys_recvmmsg(a0, (struct mmsghdr __user *)a1, a[2], a[3],
2505 (struct timespec __user *)a[4]); 2534 (struct timespec __user *)a[4]);
2506 break; 2535 break;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index dfdb5e643211..d5aed3bb3945 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3411,7 +3411,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 portid, u32 seq,
3411 (u32)sinfo->rx_bytes)) 3411 (u32)sinfo->rx_bytes))
3412 goto nla_put_failure; 3412 goto nla_put_failure;
3413 if ((sinfo->filled & (STATION_INFO_TX_BYTES | 3413 if ((sinfo->filled & (STATION_INFO_TX_BYTES |
3414 NL80211_STA_INFO_TX_BYTES64)) && 3414 STATION_INFO_TX_BYTES64)) &&
3415 nla_put_u32(msg, NL80211_STA_INFO_TX_BYTES, 3415 nla_put_u32(msg, NL80211_STA_INFO_TX_BYTES,
3416 (u32)sinfo->tx_bytes)) 3416 (u32)sinfo->tx_bytes))
3417 goto nla_put_failure; 3417 goto nla_put_failure;
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 8b5eddfba1e5..3ed35c345cae 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -231,6 +231,9 @@ void cfg80211_conn_work(struct work_struct *work)
231 mutex_lock(&rdev->sched_scan_mtx); 231 mutex_lock(&rdev->sched_scan_mtx);
232 232
233 list_for_each_entry(wdev, &rdev->wdev_list, list) { 233 list_for_each_entry(wdev, &rdev->wdev_list, list) {
234 if (!wdev->netdev)
235 continue;
236
234 wdev_lock(wdev); 237 wdev_lock(wdev);
235 if (!netif_running(wdev->netdev)) { 238 if (!netif_running(wdev->netdev)) {
236 wdev_unlock(wdev); 239 wdev_unlock(wdev);
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 23cea0f74336..ea970b8002a2 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2557,11 +2557,12 @@ static void __xfrm_garbage_collect(struct net *net)
2557 } 2557 }
2558} 2558}
2559 2559
2560static void xfrm_garbage_collect(struct net *net) 2560void xfrm_garbage_collect(struct net *net)
2561{ 2561{
2562 flow_cache_flush(); 2562 flow_cache_flush();
2563 __xfrm_garbage_collect(net); 2563 __xfrm_garbage_collect(net);
2564} 2564}
2565EXPORT_SYMBOL(xfrm_garbage_collect);
2565 2566
2566static void xfrm_garbage_collect_deferred(struct net *net) 2567static void xfrm_garbage_collect_deferred(struct net *net)
2567{ 2568{
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index aa778748c565..3f565e495ac6 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1681,6 +1681,8 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1681 1681
1682out: 1682out:
1683 xfrm_pol_put(xp); 1683 xfrm_pol_put(xp);
1684 if (delete && err == 0)
1685 xfrm_garbage_collect(net);
1684 return err; 1686 return err;
1685} 1687}
1686 1688