commit:     92d71a68a84f1c78e69d17af7292951a881c1972
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 27 13:26:19 2015 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Fri Feb 27 13:26:19 2015 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/linux-patches.git;a=commit;h=92d71a68

Linux patch 3.18.8

---
 0000_README             |   4 +
 1007_linux-3.18.8.patch | 668 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 672 insertions(+)

diff --git a/0000_README b/0000_README
index bfdd162..7c4ea05 100644
--- a/0000_README
+++ b/0000_README
@@ -71,6 +71,10 @@ Patch:  1006_linux-3.18.7.patch
 From:   http://www.kernel.org
 Desc:   Linux 3.18.7
 
+Patch:  1007_linux-3.18.8.patch
+From:   http://www.kernel.org
+Desc:   Linux 3.18.8
+
 Patch:  1500_XATTR_USER_PREFIX.patch
 From:   https://bugs.gentoo.org/show_bug.cgi?id=470644
 Desc:   Support for namespace user.pax.* on tmpfs.

diff --git a/1007_linux-3.18.8.patch b/1007_linux-3.18.8.patch
new file mode 100644
index 0000000..7cc436c
--- /dev/null
+++ b/1007_linux-3.18.8.patch
@@ -0,0 +1,668 @@
+diff --git a/Makefile b/Makefile
+index 0efae2279fbe..0b3f8a1b3715 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ VERSION = 3
+ PATCHLEVEL = 18
+-SUBLEVEL = 7
++SUBLEVEL = 8
+ EXTRAVERSION =
+ NAME = Diseased Newt
+ 
+diff --git a/drivers/media/rc/ir-lirc-codec.c 
b/drivers/media/rc/ir-lirc-codec.c
+index ed2c8a1ed8ca..98893a8332c7 100644
+--- a/drivers/media/rc/ir-lirc-codec.c
++++ b/drivers/media/rc/ir-lirc-codec.c
+@@ -42,11 +42,17 @@ static int ir_lirc_decode(struct rc_dev *dev, struct 
ir_raw_event ev)
+               return -EINVAL;
+ 
+       /* Packet start */
+-      if (ev.reset)
+-              return 0;
++      if (ev.reset) {
++              /* Userspace expects a long space event before the start of
++               * the signal to use as a sync.  This may be done with repeat
++               * packets and normal samples.  But if a reset has been sent
++               * then we assume that a long time has passed, so we send a
++               * space with the maximum time value. */
++              sample = LIRC_SPACE(LIRC_VALUE_MASK);
++              IR_dprintk(2, "delivering reset sync space to lirc_dev\n");
+ 
+       /* Carrier reports */
+-      if (ev.carrier_report) {
++      } else if (ev.carrier_report) {
+               sample = LIRC_FREQUENCY(ev.carrier);
+               IR_dprintk(2, "carrier report (freq: %d)\n", sample);
+ 
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c 
b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+index 40beef5bca88..ec4cebabff49 100644
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+@@ -3175,7 +3175,7 @@ static int bnx2x_poll(struct napi_struct *napi, int 
budget)
+               }
+ #endif
+               if (!bnx2x_fp_lock_napi(fp))
+-                      return work_done;
++                      return budget;
+ 
+               for_each_cos_in_tx_queue(fp, cos)
+                       if (bnx2x_tx_queue_has_work(fp->txdata_ptr[cos]))
+diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c 
b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+index 613037584d08..c531c8ae1be4 100644
+--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
++++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+@@ -2388,7 +2388,10 @@ static int netxen_nic_poll(struct napi_struct *napi, 
int budget)
+ 
+       work_done = netxen_process_rcv_ring(sds_ring, budget);
+ 
+-      if ((work_done < budget) && tx_complete) {
++      if (!tx_complete)
++              work_done = budget;
++
++      if (work_done < budget) {
+               napi_complete(&sds_ring->napi);
+               if (test_bit(__NX_DEV_UP, &adapter->state))
+                       netxen_nic_enable_int(sds_ring);
+diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
+index 7d76c9523395..63d7a642733d 100644
+--- a/drivers/net/hyperv/netvsc.c
++++ b/drivers/net/hyperv/netvsc.c
+@@ -716,7 +716,7 @@ int netvsc_send(struct hv_device *device,
+       u64 req_id;
+       unsigned int section_index = NETVSC_INVALID_INDEX;
+       u32 msg_size = 0;
+-      struct sk_buff *skb;
++      struct sk_buff *skb = NULL;
+       u16 q_idx = packet->q_idx;
+ 
+ 
+@@ -743,8 +743,6 @@ int netvsc_send(struct hv_device *device,
+                                                          packet);
+                       skb = (struct sk_buff *)
+                             (unsigned long)packet->send_completion_tid;
+-                      if (skb)
+-                              dev_kfree_skb_any(skb);
+                       packet->page_buf_cnt = 0;
+               }
+       }
+@@ -807,6 +805,13 @@ int netvsc_send(struct hv_device *device,
+                          packet, ret);
+       }
+ 
++      if (ret != 0) {
++              if (section_index != NETVSC_INVALID_INDEX)
++                      netvsc_free_send_slot(net_device, section_index);
++      } else if (skb) {
++              dev_kfree_skb_any(skb);
++      }
++
+       return ret;
+ }
+ 
+diff --git a/drivers/net/ppp/ppp_deflate.c b/drivers/net/ppp/ppp_deflate.c
+index 602c625d95d5..b5edc7f96a39 100644
+--- a/drivers/net/ppp/ppp_deflate.c
++++ b/drivers/net/ppp/ppp_deflate.c
+@@ -246,7 +246,7 @@ static int z_compress(void *arg, unsigned char *rptr, 
unsigned char *obuf,
+       /*
+        * See if we managed to reduce the size of the packet.
+        */
+-      if (olen < isize) {
++      if (olen < isize && olen <= osize) {
+               state->stats.comp_bytes += olen;
+               state->stats.comp_packets++;
+       } else {
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c
+index 2c9e6864abd9..fc7391e14c2a 100644
+--- a/fs/ext4/super.c
++++ b/fs/ext4/super.c
+@@ -4849,9 +4849,8 @@ static int ext4_remount(struct super_block *sb, int 
*flags, char *data)
+       if ((old_opts.s_mount_opt & EXT4_MOUNT_JOURNAL_CHECKSUM) ^
+           test_opt(sb, JOURNAL_CHECKSUM)) {
+               ext4_msg(sb, KERN_ERR, "changing journal_checksum "
+-                       "during remount not supported");
+-              err = -EINVAL;
+-              goto restore_opts;
++                       "during remount not supported; ignoring");
++              sbi->s_mount_opt ^= EXT4_MOUNT_JOURNAL_CHECKSUM;
+       }
+ 
+       if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
+diff --git a/include/net/ip.h b/include/net/ip.h
+index 0bb620702929..09cf5aebb283 100644
+--- a/include/net/ip.h
++++ b/include/net/ip.h
+@@ -39,11 +39,12 @@ struct inet_skb_parm {
+       struct ip_options       opt;            /* Compiled IP options          
*/
+       unsigned char           flags;
+ 
+-#define IPSKB_FORWARDED               1
+-#define IPSKB_XFRM_TUNNEL_SIZE        2
+-#define IPSKB_XFRM_TRANSFORMED        4
+-#define IPSKB_FRAG_COMPLETE   8
+-#define IPSKB_REROUTED                16
++#define IPSKB_FORWARDED               BIT(0)
++#define IPSKB_XFRM_TUNNEL_SIZE        BIT(1)
++#define IPSKB_XFRM_TRANSFORMED        BIT(2)
++#define IPSKB_FRAG_COMPLETE   BIT(3)
++#define IPSKB_REROUTED                BIT(4)
++#define IPSKB_DOREDIRECT      BIT(5)
+ 
+       u16                     frag_max_size;
+ };
+@@ -180,7 +181,7 @@ static inline __u8 ip_reply_arg_flowi_flags(const struct 
ip_reply_arg *arg)
+       return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0;
+ }
+ 
+-void ip_send_unicast_reply(struct net *net, struct sk_buff *skb,
++void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
+                          const struct ip_options *sopt,
+                          __be32 daddr, __be32 saddr,
+                          const struct ip_reply_arg *arg,
+diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
+index 24945cefc4fd..0ffef1a38efc 100644
+--- a/include/net/netns/ipv4.h
++++ b/include/net/netns/ipv4.h
+@@ -52,6 +52,7 @@ struct netns_ipv4 {
+       struct inet_peer_base   *peers;
+       struct tcpm_hash_bucket *tcp_metrics_hash;
+       unsigned int            tcp_metrics_hash_log;
++      struct sock  * __percpu *tcp_sk;
+       struct netns_frags      frags;
+ #ifdef CONFIG_NETFILTER
+       struct xt_table         *iptable_filter;
+diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
+index d17ed6fb2f70..5ccfe161f359 100644
+--- a/include/net/sch_generic.h
++++ b/include/net/sch_generic.h
+@@ -79,6 +79,9 @@ struct Qdisc {
+       struct netdev_queue     *dev_queue;
+ 
+       struct gnet_stats_rate_est64    rate_est;
++      struct gnet_stats_basic_cpu __percpu *cpu_bstats;
++      struct gnet_stats_queue __percpu *cpu_qstats;
++
+       struct Qdisc            *next_sched;
+       struct sk_buff          *gso_skb;
+       /*
+@@ -86,15 +89,9 @@ struct Qdisc {
+        */
+       unsigned long           state;
+       struct sk_buff_head     q;
+-      union {
+-              struct gnet_stats_basic_packed bstats;
+-              struct gnet_stats_basic_cpu __percpu *cpu_bstats;
+-      } __packed;
++      struct gnet_stats_basic_packed bstats;
+       unsigned int            __state;
+-      union {
+-              struct gnet_stats_queue qstats;
+-              struct gnet_stats_queue __percpu *cpu_qstats;
+-      } __packed;
++      struct gnet_stats_queue qstats;
+       struct rcu_head         rcu_head;
+       int                     padded;
+       atomic_t                refcnt;
+diff --git a/net/core/dev.c b/net/core/dev.c
+index 84409688ff39..9704a5c1103e 100644
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -6990,10 +6990,20 @@ static int dev_cpu_callback(struct notifier_block *nfb,
+               oldsd->output_queue = NULL;
+               oldsd->output_queue_tailp = &oldsd->output_queue;
+       }
+-      /* Append NAPI poll list from offline CPU. */
+-      if (!list_empty(&oldsd->poll_list)) {
+-              list_splice_init(&oldsd->poll_list, &sd->poll_list);
+-              raise_softirq_irqoff(NET_RX_SOFTIRQ);
++      /* Append NAPI poll list from offline CPU, with one exception :
++       * process_backlog() must be called by cpu owning percpu backlog.
++       * We properly handle process_queue & input_pkt_queue later.
++       */
++      while (!list_empty(&oldsd->poll_list)) {
++              struct napi_struct *napi = list_first_entry(&oldsd->poll_list,
++                                                          struct napi_struct,
++                                                          poll_list);
++
++              list_del_init(&napi->poll_list);
++              if (napi->poll == process_backlog)
++                      napi->state = 0;
++              else
++                      ____napi_schedule(sd, napi);
+       }
+ 
+       raise_softirq_irqoff(NET_TX_SOFTIRQ);
+@@ -7004,7 +7014,7 @@ static int dev_cpu_callback(struct notifier_block *nfb,
+               netif_rx_internal(skb);
+               input_queue_head_incr(oldsd);
+       }
+-      while ((skb = __skb_dequeue(&oldsd->input_pkt_queue))) {
++      while ((skb = skb_dequeue(&oldsd->input_pkt_queue))) {
+               netif_rx_internal(skb);
+               input_queue_head_incr(oldsd);
+       }
+diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
+index 76321ea442c3..ca82629de0b2 100644
+--- a/net/core/rtnetlink.c
++++ b/net/core/rtnetlink.c
+@@ -2770,12 +2770,16 @@ static int rtnl_bridge_notify(struct net_device *dev, 
u16 flags)
+                       goto errout;
+       }
+ 
++      if (!skb->len)
++              goto errout;
++
+       rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
+       return 0;
+ errout:
+       WARN_ON(err == -EMSGSIZE);
+       kfree_skb(skb);
+-      rtnl_set_sk_err(net, RTNLGRP_LINK, err);
++      if (err)
++              rtnl_set_sk_err(net, RTNLGRP_LINK, err);
+       return err;
+ }
+ 
+diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
+index 3a83ce5efa80..787b3c294ce6 100644
+--- a/net/ipv4/ip_forward.c
++++ b/net/ipv4/ip_forward.c
+@@ -129,7 +129,8 @@ int ip_forward(struct sk_buff *skb)
+        *      We now generate an ICMP HOST REDIRECT giving the route
+        *      we calculated.
+        */
+-      if (rt->rt_flags&RTCF_DOREDIRECT && !opt->srr && !skb_sec_path(skb))
++      if (IPCB(skb)->flags & IPSKB_DOREDIRECT && !opt->srr &&
++          !skb_sec_path(skb))
+               ip_rt_send_redirect(skb);
+ 
+       skb->priority = rt_tos2priority(iph->tos);
+diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
+index bc6471d4abcd..4a2a074bfb4a 100644
+--- a/net/ipv4/ip_output.c
++++ b/net/ipv4/ip_output.c
+@@ -1506,23 +1506,8 @@ static int ip_reply_glue_bits(void *dptr, char *to, int 
offset,
+ /*
+  *    Generic function to send a packet as reply to another packet.
+  *    Used to send some TCP resets/acks so far.
+- *
+- *    Use a fake percpu inet socket to avoid false sharing and contention.
+  */
+-static DEFINE_PER_CPU(struct inet_sock, unicast_sock) = {
+-      .sk = {
+-              .__sk_common = {
+-                      .skc_refcnt = ATOMIC_INIT(1),
+-              },
+-              .sk_wmem_alloc  = ATOMIC_INIT(1),
+-              .sk_allocation  = GFP_ATOMIC,
+-              .sk_flags       = (1UL << SOCK_USE_WRITE_QUEUE),
+-      },
+-      .pmtudisc       = IP_PMTUDISC_WANT,
+-      .uc_ttl         = -1,
+-};
+-
+-void ip_send_unicast_reply(struct net *net, struct sk_buff *skb,
++void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
+                          const struct ip_options *sopt,
+                          __be32 daddr, __be32 saddr,
+                          const struct ip_reply_arg *arg,
+@@ -1532,9 +1517,8 @@ void ip_send_unicast_reply(struct net *net, struct 
sk_buff *skb,
+       struct ipcm_cookie ipc;
+       struct flowi4 fl4;
+       struct rtable *rt = skb_rtable(skb);
++      struct net *net = sock_net(sk);
+       struct sk_buff *nskb;
+-      struct sock *sk;
+-      struct inet_sock *inet;
+       int err;
+ 
+       if (__ip_options_echo(&replyopts.opt.opt, skb, sopt))
+@@ -1565,15 +1549,11 @@ void ip_send_unicast_reply(struct net *net, struct 
sk_buff *skb,
+       if (IS_ERR(rt))
+               return;
+ 
+-      inet = &get_cpu_var(unicast_sock);
++      inet_sk(sk)->tos = arg->tos;
+ 
+-      inet->tos = arg->tos;
+-      sk = &inet->sk;
+       sk->sk_priority = skb->priority;
+       sk->sk_protocol = ip_hdr(skb)->protocol;
+       sk->sk_bound_dev_if = arg->bound_dev_if;
+-      sock_net_set(sk, net);
+-      __skb_queue_head_init(&sk->sk_write_queue);
+       sk->sk_sndbuf = sysctl_wmem_default;
+       err = ip_append_data(sk, &fl4, ip_reply_glue_bits, arg->iov->iov_base,
+                            len, 0, &ipc, &rt, MSG_DONTWAIT);
+@@ -1589,13 +1569,10 @@ void ip_send_unicast_reply(struct net *net, struct 
sk_buff *skb,
+                         arg->csumoffset) = csum_fold(csum_add(nskb->csum,
+                                                               arg->csum));
+               nskb->ip_summed = CHECKSUM_NONE;
+-              skb_orphan(nskb);
+               skb_set_queue_mapping(nskb, skb_get_queue_mapping(skb));
+               ip_push_pending_frames(sk, &fl4);
+       }
+ out:
+-      put_cpu_var(unicast_sock);
+-
+       ip_rt_put(rt);
+ }
+ 
+diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
+index 9daf2177dc00..046fce012da5 100644
+--- a/net/ipv4/ip_sockglue.c
++++ b/net/ipv4/ip_sockglue.c
+@@ -443,15 +443,11 @@ int ip_recv_error(struct sock *sk, struct msghdr *msg, 
int len, int *addr_len)
+ 
+       memcpy(&errhdr.ee, &serr->ee, sizeof(struct sock_extended_err));
+       sin = &errhdr.offender;
+-      sin->sin_family = AF_UNSPEC;
++      memset(sin, 0, sizeof(*sin));
+       if (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP) {
+-              struct inet_sock *inet = inet_sk(sk);
+-
+               sin->sin_family = AF_INET;
+               sin->sin_addr.s_addr = ip_hdr(skb)->saddr;
+-              sin->sin_port = 0;
+-              memset(&sin->sin_zero, 0, sizeof(sin->sin_zero));
+-              if (inet->cmsg_flags)
++              if (inet_sk(sk)->cmsg_flags)
+                       ip_cmsg_recv(msg, skb);
+       }
+ 
+diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
+index 5d740cccf69e..5638b179b355 100644
+--- a/net/ipv4/ping.c
++++ b/net/ipv4/ping.c
+@@ -965,8 +965,11 @@ void ping_rcv(struct sk_buff *skb)
+ 
+       sk = ping_lookup(net, skb, ntohs(icmph->un.echo.id));
+       if (sk != NULL) {
++              struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
++
+               pr_debug("rcv on socket %p\n", sk);
+-              ping_queue_rcv_skb(sk, skb_get(skb));
++              if (skb2)
++                      ping_queue_rcv_skb(sk, skb2);
+               sock_put(sk);
+               return;
+       }
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c
+index 6a2155b02602..d58dd0ec3e53 100644
+--- a/net/ipv4/route.c
++++ b/net/ipv4/route.c
+@@ -1554,11 +1554,10 @@ static int __mkroute_input(struct sk_buff *skb,
+ 
+       do_cache = res->fi && !itag;
+       if (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) &&
++          skb->protocol == htons(ETH_P_IP) &&
+           (IN_DEV_SHARED_MEDIA(out_dev) ||
+-           inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) {
+-              flags |= RTCF_DOREDIRECT;
+-              do_cache = false;
+-      }
++           inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res))))
++              IPCB(skb)->flags |= IPSKB_DOREDIRECT;
+ 
+       if (skb->protocol != htons(ETH_P_IP)) {
+               /* Not IP (i.e. ARP). Do not create route, if it is
+@@ -2303,6 +2302,8 @@ static int rt_fill_info(struct net *net,  __be32 dst, 
__be32 src,
+       r->rtm_flags    = (rt->rt_flags & ~0xFFFF) | RTM_F_CLONED;
+       if (rt->rt_flags & RTCF_NOTIFY)
+               r->rtm_flags |= RTM_F_NOTIFY;
++      if (IPCB(skb)->flags & IPSKB_DOREDIRECT)
++              r->rtm_flags |= RTCF_DOREDIRECT;
+ 
+       if (nla_put_be32(skb, RTA_DST, dst))
+               goto nla_put_failure;
+diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
+index ef7089ca86e2..944ce5edbfb7 100644
+--- a/net/ipv4/tcp_ipv4.c
++++ b/net/ipv4/tcp_ipv4.c
+@@ -683,7 +683,8 @@ static void tcp_v4_send_reset(struct sock *sk, struct 
sk_buff *skb)
+               arg.bound_dev_if = sk->sk_bound_dev_if;
+ 
+       arg.tos = ip_hdr(skb)->tos;
+-      ip_send_unicast_reply(net, skb, &TCP_SKB_CB(skb)->header.h4.opt,
++      ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk),
++                            skb, &TCP_SKB_CB(skb)->header.h4.opt,
+                             ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
+                             &arg, arg.iov[0].iov_len);
+ 
+@@ -767,7 +768,8 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, 
u32 ack,
+       if (oif)
+               arg.bound_dev_if = oif;
+       arg.tos = tos;
+-      ip_send_unicast_reply(net, skb, &TCP_SKB_CB(skb)->header.h4.opt,
++      ip_send_unicast_reply(*this_cpu_ptr(net->ipv4.tcp_sk),
++                            skb, &TCP_SKB_CB(skb)->header.h4.opt,
+                             ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
+                             &arg, arg.iov[0].iov_len);
+ 
+@@ -2426,14 +2428,39 @@ struct proto tcp_prot = {
+ };
+ EXPORT_SYMBOL(tcp_prot);
+ 
++static void __net_exit tcp_sk_exit(struct net *net)
++{
++      int cpu;
++
++      for_each_possible_cpu(cpu)
++              inet_ctl_sock_destroy(*per_cpu_ptr(net->ipv4.tcp_sk, cpu));
++      free_percpu(net->ipv4.tcp_sk);
++}
++
+ static int __net_init tcp_sk_init(struct net *net)
+ {
++      int res, cpu;
++
++      net->ipv4.tcp_sk = alloc_percpu(struct sock *);
++      if (!net->ipv4.tcp_sk)
++              return -ENOMEM;
++
++      for_each_possible_cpu(cpu) {
++              struct sock *sk;
++
++              res = inet_ctl_sock_create(&sk, PF_INET, SOCK_RAW,
++                                         IPPROTO_TCP, net);
++              if (res)
++                      goto fail;
++              *per_cpu_ptr(net->ipv4.tcp_sk, cpu) = sk;
++      }
+       net->ipv4.sysctl_tcp_ecn = 2;
+       return 0;
+-}
+ 
+-static void __net_exit tcp_sk_exit(struct net *net)
+-{
++fail:
++      tcp_sk_exit(net);
++
++      return res;
+ }
+ 
+ static void __net_exit tcp_sk_exit_batch(struct list_head *net_exit_list)
+diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c
+index 7927db0a9279..4a000f1dd757 100644
+--- a/net/ipv4/udp_diag.c
++++ b/net/ipv4/udp_diag.c
+@@ -99,11 +99,13 @@ static void udp_dump(struct udp_table *table, struct 
sk_buff *skb, struct netlin
+       s_slot = cb->args[0];
+       num = s_num = cb->args[1];
+ 
+-      for (slot = s_slot; slot <= table->mask; num = s_num = 0, slot++) {
++      for (slot = s_slot; slot <= table->mask; s_num = 0, slot++) {
+               struct sock *sk;
+               struct hlist_nulls_node *node;
+               struct udp_hslot *hslot = &table->hash[slot];
+ 
++              num = 0;
++
+               if (hlist_nulls_empty(&hslot->head))
+                       continue;
+ 
+diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
+index 2cdc38338be3..11e3945eeac7 100644
+--- a/net/ipv6/datagram.c
++++ b/net/ipv6/datagram.c
+@@ -383,11 +383,10 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, 
int len, int *addr_len)
+ 
+       memcpy(&errhdr.ee, &serr->ee, sizeof(struct sock_extended_err));
+       sin = &errhdr.offender;
+-      sin->sin6_family = AF_UNSPEC;
++      memset(sin, 0, sizeof(*sin));
++
+       if (serr->ee.ee_origin != SO_EE_ORIGIN_LOCAL) {
+               sin->sin6_family = AF_INET6;
+-              sin->sin6_flowinfo = 0;
+-              sin->sin6_port = 0;
+               if (np->rxopt.all)
+                       ip6_datagram_recv_common_ctl(sk, msg, skb);
+               if (skb->protocol == htons(ETH_P_IPV6)) {
+@@ -398,12 +397,9 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, 
int len, int *addr_len)
+                               ipv6_iface_scope_id(&sin->sin6_addr,
+                                                   IP6CB(skb)->iif);
+               } else {
+-                      struct inet_sock *inet = inet_sk(sk);
+-
+                       ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr,
+                                              &sin->sin6_addr);
+-                      sin->sin6_scope_id = 0;
+-                      if (inet->cmsg_flags)
++                      if (inet_sk(sk)->cmsg_flags)
+                               ip_cmsg_recv(msg, skb);
+               }
+       }
+diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
+index b2d1838897c9..f1c6d5e98322 100644
+--- a/net/ipv6/ip6_fib.c
++++ b/net/ipv6/ip6_fib.c
+@@ -659,6 +659,29 @@ static int fib6_commit_metrics(struct dst_entry *dst,
+       return 0;
+ }
+ 
++static void fib6_purge_rt(struct rt6_info *rt, struct fib6_node *fn,
++                        struct net *net)
++{
++      if (atomic_read(&rt->rt6i_ref) != 1) {
++              /* This route is used as dummy address holder in some split
++               * nodes. It is not leaked, but it still holds other resources,
++               * which must be released in time. So, scan ascendant nodes
++               * and replace dummy references to this route with references
++               * to still alive ones.
++               */
++              while (fn) {
++                      if (!(fn->fn_flags & RTN_RTINFO) && fn->leaf == rt) {
++                              fn->leaf = fib6_find_prefix(net, fn);
++                              atomic_inc(&fn->leaf->rt6i_ref);
++                              rt6_release(rt);
++                      }
++                      fn = fn->parent;
++              }
++              /* No more references are possible at this point. */
++              BUG_ON(atomic_read(&rt->rt6i_ref) != 1);
++      }
++}
++
+ /*
+  *    Insert routing information in a node.
+  */
+@@ -807,11 +830,12 @@ add:
+               rt->dst.rt6_next = iter->dst.rt6_next;
+               atomic_inc(&rt->rt6i_ref);
+               inet6_rt_notify(RTM_NEWROUTE, rt, info);
+-              rt6_release(iter);
+               if (!(fn->fn_flags & RTN_RTINFO)) {
+                       info->nl_net->ipv6.rt6_stats->fib_route_nodes++;
+                       fn->fn_flags |= RTN_RTINFO;
+               }
++              fib6_purge_rt(iter, fn, info->nl_net);
++              rt6_release(iter);
+       }
+ 
+       return 0;
+@@ -1322,24 +1346,7 @@ static void fib6_del_route(struct fib6_node *fn, struct 
rt6_info **rtp,
+               fn = fib6_repair_tree(net, fn);
+       }
+ 
+-      if (atomic_read(&rt->rt6i_ref) != 1) {
+-              /* This route is used as dummy address holder in some split
+-               * nodes. It is not leaked, but it still holds other resources,
+-               * which must be released in time. So, scan ascendant nodes
+-               * and replace dummy references to this route with references
+-               * to still alive ones.
+-               */
+-              while (fn) {
+-                      if (!(fn->fn_flags & RTN_RTINFO) && fn->leaf == rt) {
+-                              fn->leaf = fib6_find_prefix(net, fn);
+-                              atomic_inc(&fn->leaf->rt6i_ref);
+-                              rt6_release(rt);
+-                      }
+-                      fn = fn->parent;
+-              }
+-              /* No more references are possible at this point. */
+-              BUG_ON(atomic_read(&rt->rt6i_ref) != 1);
+-      }
++      fib6_purge_rt(rt, fn, net);
+ 
+       inet6_rt_notify(RTM_DELROUTE, rt, info);
+       rt6_release(rt);
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c
+index a318dd89b6d9..d02ee019382e 100644
+--- a/net/ipv6/route.c
++++ b/net/ipv6/route.c
+@@ -1150,12 +1150,9 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, 
struct sock *sk,
+               struct net *net = dev_net(dst->dev);
+ 
+               rt6->rt6i_flags |= RTF_MODIFIED;
+-              if (mtu < IPV6_MIN_MTU) {
+-                      u32 features = dst_metric(dst, RTAX_FEATURES);
++              if (mtu < IPV6_MIN_MTU)
+                       mtu = IPV6_MIN_MTU;
+-                      features |= RTAX_FEATURE_ALLFRAG;
+-                      dst_metric_set(dst, RTAX_FEATURES, features);
+-              }
++
+               dst_metric_set(dst, RTAX_MTU, mtu);
+               rt6_update_expires(rt6, net->ipv6.sysctl.ip6_rt_mtu_expires);
+       }
+diff --git a/net/sctp/associola.c b/net/sctp/associola.c
+index f791edd64d6c..26d06dbcc1c8 100644
+--- a/net/sctp/associola.c
++++ b/net/sctp/associola.c
+@@ -1182,7 +1182,6 @@ void sctp_assoc_update(struct sctp_association *asoc,
+       asoc->peer.peer_hmacs = new->peer.peer_hmacs;
+       new->peer.peer_hmacs = NULL;
+ 
+-      sctp_auth_key_put(asoc->asoc_shared_key);
+       sctp_auth_asoc_init_active_key(asoc, GFP_ATOMIC);
+ }
+ 
+diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
+index 9f32741abb1c..371a152d9759 100644
+--- a/net/sctp/sm_make_chunk.c
++++ b/net/sctp/sm_make_chunk.c
+@@ -2608,7 +2608,7 @@ do_addr_param:
+ 
+               addr_param = param.v + sizeof(sctp_addip_param_t);
+ 
+-              af = sctp_get_af_specific(param_type2af(param.p->type));
++              af = sctp_get_af_specific(param_type2af(addr_param->p.type));
+               if (af == NULL)
+                       break;
+ 
+diff --git a/net/socket.c b/net/socket.c
+index fe20c319a0bb..cf9ebf10c841 100644
+--- a/net/socket.c
++++ b/net/socket.c
+@@ -892,9 +892,6 @@ static ssize_t sock_splice_read(struct file *file, loff_t 
*ppos,
+ static struct sock_iocb *alloc_sock_iocb(struct kiocb *iocb,
+                                        struct sock_iocb *siocb)
+ {
+-      if (!is_sync_kiocb(iocb))
+-              BUG();
+-
+       siocb->kiocb = iocb;
+       iocb->private = siocb;
+       return siocb;

Reply via email to