aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-07 15:10:57 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-07 15:10:57 -0500
commit926af6273fc683cd98cd0ce7bf0d04a02eed6742 (patch)
tree99c40d2bc42563a92c2877e58e32a6b4c922ba30 /net
parentb6789123bccba8b5feb9901ed2e8c3c39181979d (diff)
parent912964eacb111551db73429719eb5fadcab0ff8a (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Load correct firmware in rtl8192ce wireless driver, from Jurij Smakov. 2) Fix leak of tx_ring and tx_cq due to overwriting in mlx4 driver, from Martin KaFai Lau. 3) Need to reference count PHY driver module when it is attached, from Mao Wenan. 4) Don't do zero length vzalloc() in ethtool register dump, from Stanislaw Gruszka. 5) Defer net_disable_timestamp() to a workqueue to get out of locking issues, from Eric Dumazet. 6) We cannot drop the SKB dst when IP options refer to them, fix also from Eric Dumazet. 7) Incorrect packet header offset calculations in ip6_gre, again from Eric Dumazet. 8) Missing tcp_v6_restore_cb() causes use-after-free, from Eric too. 9) tcp_splice_read() can get into an infinite loop with URG, and hey it's from Eric once more. 10) vnet_hdr_sz can change asynchronously, so read it once during decision making in macvtap and tun, from Willem de Bruijn. 11) Can't use kernel stack for DMA transfers in USB networking drivers, from Ben Hutchings. 12) Handle csum errors properly in UDP by calling the proper destructor, from Eric Dumazet. 13) For non-deterministic softirq run when scheduling NAPI from a workqueue in mlx4, from Benjamin Poirier. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (28 commits) sctp: check af before verify address in sctp_addr_id2transport sctp: avoid BUG_ON on sctp_wait_for_sndbuf mlx4: Invoke softirqs after napi_reschedule udp: properly cope with csum errors catc: Use heap buffer for memory size test catc: Combine failure cleanup code in catc_probe() rtl8150: Use heap buffers for all register access pegasus: Use heap buffers for all register access macvtap: read vnet_hdr_size once tun: read vnet_hdr_sz once tcp: avoid infinite loop in tcp_splice_read() hns: avoid stack overflow with CONFIG_KASAN ipv6: Fix IPv6 packet loss in scenarios involving roaming + snooping switches ipv6: tcp: add a missing tcp_v6_restore_cb() nl80211: Fix mesh HT operation check mac80211: Fix adding of mesh vendor IEs mac80211: Allocate a sync skcipher explicitly for FILS AEAD mac80211: Fix FILS AEAD protection in Association Request frame ip6_gre: fix ip6gre_err() invalid reads netlabel: out of bound access in cipso_v4_validate() ...
Diffstat (limited to 'net')
-rw-r--r--net/core/datagram.c8
-rw-r--r--net/core/dev.c31
-rw-r--r--net/core/ethtool.c9
-rw-r--r--net/ipv4/cipso_ipv4.c4
-rw-r--r--net/ipv4/ip_sockglue.c9
-rw-r--r--net/ipv4/tcp.c6
-rw-r--r--net/ipv4/udp.c2
-rw-r--r--net/ipv6/addrconf.c10
-rw-r--r--net/ipv6/exthdrs.c31
-rw-r--r--net/ipv6/ip6_gre.c40
-rw-r--r--net/ipv6/seg6_hmac.c8
-rw-r--r--net/ipv6/tcp_ipv6.c24
-rw-r--r--net/ipv6/udp.c2
-rw-r--r--net/mac80211/fils_aead.c6
-rw-r--r--net/mac80211/mesh.c2
-rw-r--r--net/sctp/socket.c5
-rw-r--r--net/wireless/nl80211.c1
17 files changed, 102 insertions, 96 deletions
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 662bea587165..ea633342ab0d 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -332,7 +332,9 @@ void __skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb, int len)
332EXPORT_SYMBOL(__skb_free_datagram_locked); 332EXPORT_SYMBOL(__skb_free_datagram_locked);
333 333
334int __sk_queue_drop_skb(struct sock *sk, struct sk_buff *skb, 334int __sk_queue_drop_skb(struct sock *sk, struct sk_buff *skb,
335 unsigned int flags) 335 unsigned int flags,
336 void (*destructor)(struct sock *sk,
337 struct sk_buff *skb))
336{ 338{
337 int err = 0; 339 int err = 0;
338 340
@@ -342,6 +344,8 @@ int __sk_queue_drop_skb(struct sock *sk, struct sk_buff *skb,
342 if (skb == skb_peek(&sk->sk_receive_queue)) { 344 if (skb == skb_peek(&sk->sk_receive_queue)) {
343 __skb_unlink(skb, &sk->sk_receive_queue); 345 __skb_unlink(skb, &sk->sk_receive_queue);
344 atomic_dec(&skb->users); 346 atomic_dec(&skb->users);
347 if (destructor)
348 destructor(sk, skb);
345 err = 0; 349 err = 0;
346 } 350 }
347 spin_unlock_bh(&sk->sk_receive_queue.lock); 351 spin_unlock_bh(&sk->sk_receive_queue.lock);
@@ -375,7 +379,7 @@ EXPORT_SYMBOL(__sk_queue_drop_skb);
375 379
376int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags) 380int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags)
377{ 381{
378 int err = __sk_queue_drop_skb(sk, skb, flags); 382 int err = __sk_queue_drop_skb(sk, skb, flags, NULL);
379 383
380 kfree_skb(skb); 384 kfree_skb(skb);
381 sk_mem_reclaim_partial(sk); 385 sk_mem_reclaim_partial(sk);
diff --git a/net/core/dev.c b/net/core/dev.c
index 7f218e095361..29101c98399f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1695,24 +1695,19 @@ EXPORT_SYMBOL_GPL(net_dec_egress_queue);
1695 1695
1696static struct static_key netstamp_needed __read_mostly; 1696static struct static_key netstamp_needed __read_mostly;
1697#ifdef HAVE_JUMP_LABEL 1697#ifdef HAVE_JUMP_LABEL
1698/* We are not allowed to call static_key_slow_dec() from irq context
1699 * If net_disable_timestamp() is called from irq context, defer the
1700 * static_key_slow_dec() calls.
1701 */
1702static atomic_t netstamp_needed_deferred; 1698static atomic_t netstamp_needed_deferred;
1703#endif 1699static void netstamp_clear(struct work_struct *work)
1704
1705void net_enable_timestamp(void)
1706{ 1700{
1707#ifdef HAVE_JUMP_LABEL
1708 int deferred = atomic_xchg(&netstamp_needed_deferred, 0); 1701 int deferred = atomic_xchg(&netstamp_needed_deferred, 0);
1709 1702
1710 if (deferred) { 1703 while (deferred--)
1711 while (--deferred) 1704 static_key_slow_dec(&netstamp_needed);
1712 static_key_slow_dec(&netstamp_needed); 1705}
1713 return; 1706static DECLARE_WORK(netstamp_work, netstamp_clear);
1714 }
1715#endif 1707#endif
1708
1709void net_enable_timestamp(void)
1710{
1716 static_key_slow_inc(&netstamp_needed); 1711 static_key_slow_inc(&netstamp_needed);
1717} 1712}
1718EXPORT_SYMBOL(net_enable_timestamp); 1713EXPORT_SYMBOL(net_enable_timestamp);
@@ -1720,12 +1715,12 @@ EXPORT_SYMBOL(net_enable_timestamp);
1720void net_disable_timestamp(void) 1715void net_disable_timestamp(void)
1721{ 1716{
1722#ifdef HAVE_JUMP_LABEL 1717#ifdef HAVE_JUMP_LABEL
1723 if (in_interrupt()) { 1718 /* net_disable_timestamp() can be called from non process context */
1724 atomic_inc(&netstamp_needed_deferred); 1719 atomic_inc(&netstamp_needed_deferred);
1725 return; 1720 schedule_work(&netstamp_work);
1726 } 1721#else
1727#endif
1728 static_key_slow_dec(&netstamp_needed); 1722 static_key_slow_dec(&netstamp_needed);
1723#endif
1729} 1724}
1730EXPORT_SYMBOL(net_disable_timestamp); 1725EXPORT_SYMBOL(net_disable_timestamp);
1731 1726
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 236a21e3c878..d92de0a1f0a4 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -1405,9 +1405,12 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr)
1405 if (regs.len > reglen) 1405 if (regs.len > reglen)
1406 regs.len = reglen; 1406 regs.len = reglen;
1407 1407
1408 regbuf = vzalloc(reglen); 1408 regbuf = NULL;
1409 if (reglen && !regbuf) 1409 if (reglen) {
1410 return -ENOMEM; 1410 regbuf = vzalloc(reglen);
1411 if (!regbuf)
1412 return -ENOMEM;
1413 }
1411 1414
1412 ops->get_regs(dev, &regs, regbuf); 1415 ops->get_regs(dev, &regs, regbuf);
1413 1416
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index 72d6f056d863..ae206163c273 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -1587,6 +1587,10 @@ int cipso_v4_validate(const struct sk_buff *skb, unsigned char **option)
1587 goto validate_return_locked; 1587 goto validate_return_locked;
1588 } 1588 }
1589 1589
1590 if (opt_iter + 1 == opt_len) {
1591 err_offset = opt_iter;
1592 goto validate_return_locked;
1593 }
1590 tag_len = tag[1]; 1594 tag_len = tag[1];
1591 if (tag_len > (opt_len - opt_iter)) { 1595 if (tag_len > (opt_len - opt_iter)) {
1592 err_offset = opt_iter + 1; 1596 err_offset = opt_iter + 1;
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 53ae0c6315ad..900011709e3b 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -1238,7 +1238,14 @@ void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)
1238 pktinfo->ipi_ifindex = 0; 1238 pktinfo->ipi_ifindex = 0;
1239 pktinfo->ipi_spec_dst.s_addr = 0; 1239 pktinfo->ipi_spec_dst.s_addr = 0;
1240 } 1240 }
1241 skb_dst_drop(skb); 1241 /* We need to keep the dst for __ip_options_echo()
1242 * We could restrict the test to opt.ts_needtime || opt.srr,
1243 * but the following is good enough as IP options are not often used.
1244 */
1245 if (unlikely(IPCB(skb)->opt.optlen))
1246 skb_dst_force(skb);
1247 else
1248 skb_dst_drop(skb);
1242} 1249}
1243 1250
1244int ip_setsockopt(struct sock *sk, int level, 1251int ip_setsockopt(struct sock *sk, int level,
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 4a044964da66..0efb4c7f6704 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -770,6 +770,12 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
770 ret = -EAGAIN; 770 ret = -EAGAIN;
771 break; 771 break;
772 } 772 }
773 /* if __tcp_splice_read() got nothing while we have
774 * an skb in receive queue, we do not want to loop.
775 * This might happen with URG data.
776 */
777 if (!skb_queue_empty(&sk->sk_receive_queue))
778 break;
773 sk_wait_data(sk, &timeo, NULL); 779 sk_wait_data(sk, &timeo, NULL);
774 if (signal_pending(current)) { 780 if (signal_pending(current)) {
775 ret = sock_intr_errno(timeo); 781 ret = sock_intr_errno(timeo);
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 1307a7c2e544..8aab7d78d25b 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1501,7 +1501,7 @@ try_again:
1501 return err; 1501 return err;
1502 1502
1503csum_copy_err: 1503csum_copy_err:
1504 if (!__sk_queue_drop_skb(sk, skb, flags)) { 1504 if (!__sk_queue_drop_skb(sk, skb, flags, udp_skb_destructor)) {
1505 UDP_INC_STATS(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite); 1505 UDP_INC_STATS(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite);
1506 UDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite); 1506 UDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
1507 } 1507 }
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index f60e88e56255..81f7b4ea4281 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3386,9 +3386,15 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
3386 } 3386 }
3387 3387
3388 if (idev) { 3388 if (idev) {
3389 if (idev->if_flags & IF_READY) 3389 if (idev->if_flags & IF_READY) {
3390 /* device is already configured. */ 3390 /* device is already configured -
3391 * but resend MLD reports, we might
3392 * have roamed and need to update
3393 * multicast snooping switches
3394 */
3395 ipv6_mc_up(idev);
3391 break; 3396 break;
3397 }
3392 idev->if_flags |= IF_READY; 3398 idev->if_flags |= IF_READY;
3393 } 3399 }
3394 3400
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index e4198502fd98..275cac628a95 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -327,7 +327,6 @@ static int ipv6_srh_rcv(struct sk_buff *skb)
327 struct ipv6_sr_hdr *hdr; 327 struct ipv6_sr_hdr *hdr;
328 struct inet6_dev *idev; 328 struct inet6_dev *idev;
329 struct in6_addr *addr; 329 struct in6_addr *addr;
330 bool cleanup = false;
331 int accept_seg6; 330 int accept_seg6;
332 331
333 hdr = (struct ipv6_sr_hdr *)skb_transport_header(skb); 332 hdr = (struct ipv6_sr_hdr *)skb_transport_header(skb);
@@ -351,11 +350,7 @@ static int ipv6_srh_rcv(struct sk_buff *skb)
351#endif 350#endif
352 351
353looped_back: 352looped_back:
354 if (hdr->segments_left > 0) { 353 if (hdr->segments_left == 0) {
355 if (hdr->nexthdr != NEXTHDR_IPV6 && hdr->segments_left == 1 &&
356 sr_has_cleanup(hdr))
357 cleanup = true;
358 } else {
359 if (hdr->nexthdr == NEXTHDR_IPV6) { 354 if (hdr->nexthdr == NEXTHDR_IPV6) {
360 int offset = (hdr->hdrlen + 1) << 3; 355 int offset = (hdr->hdrlen + 1) << 3;
361 356
@@ -418,21 +413,6 @@ looped_back:
418 413
419 ipv6_hdr(skb)->daddr = *addr; 414 ipv6_hdr(skb)->daddr = *addr;
420 415
421 if (cleanup) {
422 int srhlen = (hdr->hdrlen + 1) << 3;
423 int nh = hdr->nexthdr;
424
425 skb_pull_rcsum(skb, sizeof(struct ipv6hdr) + srhlen);
426 memmove(skb_network_header(skb) + srhlen,
427 skb_network_header(skb),
428 (unsigned char *)hdr - skb_network_header(skb));
429 skb->network_header += srhlen;
430 ipv6_hdr(skb)->nexthdr = nh;
431 ipv6_hdr(skb)->payload_len = htons(skb->len -
432 sizeof(struct ipv6hdr));
433 skb_push_rcsum(skb, sizeof(struct ipv6hdr));
434 }
435
436 skb_dst_drop(skb); 416 skb_dst_drop(skb);
437 417
438 ip6_route_input(skb); 418 ip6_route_input(skb);
@@ -453,13 +433,8 @@ looped_back:
453 } 433 }
454 ipv6_hdr(skb)->hop_limit--; 434 ipv6_hdr(skb)->hop_limit--;
455 435
456 /* be sure that srh is still present before reinjecting */ 436 skb_pull(skb, sizeof(struct ipv6hdr));
457 if (!cleanup) { 437 goto looped_back;
458 skb_pull(skb, sizeof(struct ipv6hdr));
459 goto looped_back;
460 }
461 skb_set_transport_header(skb, sizeof(struct ipv6hdr));
462 IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);
463 } 438 }
464 439
465 dst_input(skb); 440 dst_input(skb);
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 558631860d91..630b73be5999 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -367,35 +367,37 @@ static void ip6gre_tunnel_uninit(struct net_device *dev)
367 367
368 368
369static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 369static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
370 u8 type, u8 code, int offset, __be32 info) 370 u8 type, u8 code, int offset, __be32 info)
371{ 371{
372 const struct ipv6hdr *ipv6h = (const struct ipv6hdr *)skb->data; 372 const struct gre_base_hdr *greh;
373 __be16 *p = (__be16 *)(skb->data + offset); 373 const struct ipv6hdr *ipv6h;
374 int grehlen = offset + 4; 374 int grehlen = sizeof(*greh);
375 struct ip6_tnl *t; 375 struct ip6_tnl *t;
376 int key_off = 0;
376 __be16 flags; 377 __be16 flags;
378 __be32 key;
377 379
378 flags = p[0]; 380 if (!pskb_may_pull(skb, offset + grehlen))
379 if (flags&(GRE_CSUM|GRE_KEY|GRE_SEQ|GRE_ROUTING|GRE_VERSION)) { 381 return;
380 if (flags&(GRE_VERSION|GRE_ROUTING)) 382 greh = (const struct gre_base_hdr *)(skb->data + offset);
381 return; 383 flags = greh->flags;
382 if (flags&GRE_KEY) { 384 if (flags & (GRE_VERSION | GRE_ROUTING))
383 grehlen += 4; 385 return;
384 if (flags&GRE_CSUM) 386 if (flags & GRE_CSUM)
385 grehlen += 4; 387 grehlen += 4;
386 } 388 if (flags & GRE_KEY) {
389 key_off = grehlen + offset;
390 grehlen += 4;
387 } 391 }
388 392
389 /* If only 8 bytes returned, keyed message will be dropped here */ 393 if (!pskb_may_pull(skb, offset + grehlen))
390 if (!pskb_may_pull(skb, grehlen))
391 return; 394 return;
392 ipv6h = (const struct ipv6hdr *)skb->data; 395 ipv6h = (const struct ipv6hdr *)skb->data;
393 p = (__be16 *)(skb->data + offset); 396 greh = (const struct gre_base_hdr *)(skb->data + offset);
397 key = key_off ? *(__be32 *)(skb->data + key_off) : 0;
394 398
395 t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr, 399 t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr,
396 flags & GRE_KEY ? 400 key, greh->protocol);
397 *(((__be32 *)p) + (grehlen / 4) - 1) : 0,
398 p[1]);
399 if (!t) 401 if (!t)
400 return; 402 return;
401 403
diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c
index 03a064803626..6ef3dfb6e811 100644
--- a/net/ipv6/seg6_hmac.c
+++ b/net/ipv6/seg6_hmac.c
@@ -174,7 +174,7 @@ int seg6_hmac_compute(struct seg6_hmac_info *hinfo, struct ipv6_sr_hdr *hdr,
174 * hash function (RadioGatun) with up to 1216 bits 174 * hash function (RadioGatun) with up to 1216 bits
175 */ 175 */
176 176
177 /* saddr(16) + first_seg(1) + cleanup(1) + keyid(4) + seglist(16n) */ 177 /* saddr(16) + first_seg(1) + flags(1) + keyid(4) + seglist(16n) */
178 plen = 16 + 1 + 1 + 4 + (hdr->first_segment + 1) * 16; 178 plen = 16 + 1 + 1 + 4 + (hdr->first_segment + 1) * 16;
179 179
180 /* this limit allows for 14 segments */ 180 /* this limit allows for 14 segments */
@@ -186,7 +186,7 @@ int seg6_hmac_compute(struct seg6_hmac_info *hinfo, struct ipv6_sr_hdr *hdr,
186 * 186 *
187 * 1. Source IPv6 address (128 bits) 187 * 1. Source IPv6 address (128 bits)
188 * 2. first_segment value (8 bits) 188 * 2. first_segment value (8 bits)
189 * 3. cleanup flag (8 bits: highest bit is cleanup value, others are 0) 189 * 3. Flags (8 bits)
190 * 4. HMAC Key ID (32 bits) 190 * 4. HMAC Key ID (32 bits)
191 * 5. All segments in the segments list (n * 128 bits) 191 * 5. All segments in the segments list (n * 128 bits)
192 */ 192 */
@@ -202,8 +202,8 @@ int seg6_hmac_compute(struct seg6_hmac_info *hinfo, struct ipv6_sr_hdr *hdr,
202 /* first_segment value */ 202 /* first_segment value */
203 *off++ = hdr->first_segment; 203 *off++ = hdr->first_segment;
204 204
205 /* cleanup flag */ 205 /* flags */
206 *off++ = !!(sr_has_cleanup(hdr)) << 7; 206 *off++ = hdr->flags;
207 207
208 /* HMAC Key ID */ 208 /* HMAC Key ID */
209 memcpy(off, &hmackeyid, 4); 209 memcpy(off, &hmackeyid, 4);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index cb8929681dc7..eaad72c3d746 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -991,6 +991,16 @@ drop:
991 return 0; /* don't send reset */ 991 return 0; /* don't send reset */
992} 992}
993 993
994static void tcp_v6_restore_cb(struct sk_buff *skb)
995{
996 /* We need to move header back to the beginning if xfrm6_policy_check()
997 * and tcp_v6_fill_cb() are going to be called again.
998 * ip6_datagram_recv_specific_ctl() also expects IP6CB to be there.
999 */
1000 memmove(IP6CB(skb), &TCP_SKB_CB(skb)->header.h6,
1001 sizeof(struct inet6_skb_parm));
1002}
1003
994static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb, 1004static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
995 struct request_sock *req, 1005 struct request_sock *req,
996 struct dst_entry *dst, 1006 struct dst_entry *dst,
@@ -1182,8 +1192,10 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *
1182 sk_gfp_mask(sk, GFP_ATOMIC)); 1192 sk_gfp_mask(sk, GFP_ATOMIC));
1183 consume_skb(ireq->pktopts); 1193 consume_skb(ireq->pktopts);
1184 ireq->pktopts = NULL; 1194 ireq->pktopts = NULL;
1185 if (newnp->pktoptions) 1195 if (newnp->pktoptions) {
1196 tcp_v6_restore_cb(newnp->pktoptions);
1186 skb_set_owner_r(newnp->pktoptions, newsk); 1197 skb_set_owner_r(newnp->pktoptions, newsk);
1198 }
1187 } 1199 }
1188 } 1200 }
1189 1201
@@ -1198,16 +1210,6 @@ out:
1198 return NULL; 1210 return NULL;
1199} 1211}
1200 1212
1201static void tcp_v6_restore_cb(struct sk_buff *skb)
1202{
1203 /* We need to move header back to the beginning if xfrm6_policy_check()
1204 * and tcp_v6_fill_cb() are going to be called again.
1205 * ip6_datagram_recv_specific_ctl() also expects IP6CB to be there.
1206 */
1207 memmove(IP6CB(skb), &TCP_SKB_CB(skb)->header.h6,
1208 sizeof(struct inet6_skb_parm));
1209}
1210
1211/* The socket must have it's spinlock held when we get 1213/* The socket must have it's spinlock held when we get
1212 * here, unless it is a TCP_LISTEN socket. 1214 * here, unless it is a TCP_LISTEN socket.
1213 * 1215 *
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 4d5c4eee4b3f..8990856f5101 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -441,7 +441,7 @@ try_again:
441 return err; 441 return err;
442 442
443csum_copy_err: 443csum_copy_err:
444 if (!__sk_queue_drop_skb(sk, skb, flags)) { 444 if (!__sk_queue_drop_skb(sk, skb, flags, udp_skb_destructor)) {
445 if (is_udp4) { 445 if (is_udp4) {
446 UDP_INC_STATS(sock_net(sk), 446 UDP_INC_STATS(sock_net(sk),
447 UDP_MIB_CSUMERRORS, is_udplite); 447 UDP_MIB_CSUMERRORS, is_udplite);
diff --git a/net/mac80211/fils_aead.c b/net/mac80211/fils_aead.c
index ecfdd97758a3..5c3af5eb4052 100644
--- a/net/mac80211/fils_aead.c
+++ b/net/mac80211/fils_aead.c
@@ -124,7 +124,7 @@ static int aes_siv_encrypt(const u8 *key, size_t key_len,
124 124
125 /* CTR */ 125 /* CTR */
126 126
127 tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, 0); 127 tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC);
128 if (IS_ERR(tfm2)) { 128 if (IS_ERR(tfm2)) {
129 kfree(tmp); 129 kfree(tmp);
130 return PTR_ERR(tfm2); 130 return PTR_ERR(tfm2);
@@ -183,7 +183,7 @@ static int aes_siv_decrypt(const u8 *key, size_t key_len,
183 183
184 /* CTR */ 184 /* CTR */
185 185
186 tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, 0); 186 tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC);
187 if (IS_ERR(tfm2)) 187 if (IS_ERR(tfm2))
188 return PTR_ERR(tfm2); 188 return PTR_ERR(tfm2);
189 /* K2 for CTR */ 189 /* K2 for CTR */
@@ -272,7 +272,7 @@ int fils_encrypt_assoc_req(struct sk_buff *skb,
272 crypt_len = skb->data + skb->len - encr; 272 crypt_len = skb->data + skb->len - encr;
273 skb_put(skb, AES_BLOCK_SIZE); 273 skb_put(skb, AES_BLOCK_SIZE);
274 return aes_siv_encrypt(assoc_data->fils_kek, assoc_data->fils_kek_len, 274 return aes_siv_encrypt(assoc_data->fils_kek, assoc_data->fils_kek_len,
275 encr, crypt_len, 1, addr, len, encr); 275 encr, crypt_len, 5, addr, len, encr);
276} 276}
277 277
278int fils_decrypt_assoc_resp(struct ieee80211_sub_if_data *sdata, 278int fils_decrypt_assoc_resp(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 42120d965263..50e1b7f78bd4 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -339,7 +339,7 @@ int mesh_add_vendor_ies(struct ieee80211_sub_if_data *sdata,
339 /* fast-forward to vendor IEs */ 339 /* fast-forward to vendor IEs */
340 offset = ieee80211_ie_split_vendor(ifmsh->ie, ifmsh->ie_len, 0); 340 offset = ieee80211_ie_split_vendor(ifmsh->ie, ifmsh->ie_len, 0);
341 341
342 if (offset) { 342 if (offset < ifmsh->ie_len) {
343 len = ifmsh->ie_len - offset; 343 len = ifmsh->ie_len - offset;
344 data = ifmsh->ie + offset; 344 data = ifmsh->ie + offset;
345 if (skb_tailroom(skb) < len) 345 if (skb_tailroom(skb) < len)
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 37eeab7899fc..1b5d669e3029 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -239,7 +239,7 @@ static struct sctp_transport *sctp_addr_id2transport(struct sock *sk,
239 union sctp_addr *laddr = (union sctp_addr *)addr; 239 union sctp_addr *laddr = (union sctp_addr *)addr;
240 struct sctp_transport *transport; 240 struct sctp_transport *transport;
241 241
242 if (sctp_verify_addr(sk, laddr, af->sockaddr_len)) 242 if (!af || sctp_verify_addr(sk, laddr, af->sockaddr_len))
243 return NULL; 243 return NULL;
244 244
245 addr_asoc = sctp_endpoint_lookup_assoc(sctp_sk(sk)->ep, 245 addr_asoc = sctp_endpoint_lookup_assoc(sctp_sk(sk)->ep,
@@ -7426,7 +7426,8 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,
7426 */ 7426 */
7427 release_sock(sk); 7427 release_sock(sk);
7428 current_timeo = schedule_timeout(current_timeo); 7428 current_timeo = schedule_timeout(current_timeo);
7429 BUG_ON(sk != asoc->base.sk); 7429 if (sk != asoc->base.sk)
7430 goto do_error;
7430 lock_sock(sk); 7431 lock_sock(sk);
7431 7432
7432 *timeo_p = current_timeo; 7433 *timeo_p = current_timeo;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 5c1b267e22be..aee396b9f190 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5916,6 +5916,7 @@ do { \
5916 break; 5916 break;
5917 } 5917 }
5918 cfg->ht_opmode = ht_opmode; 5918 cfg->ht_opmode = ht_opmode;
5919 mask |= (1 << (NL80211_MESHCONF_HT_OPMODE - 1));
5919 } 5920 }
5920 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPactivePathToRootTimeout, 5921 FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPactivePathToRootTimeout,
5921 1, 65535, mask, 5922 1, 65535, mask,