aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-12-01 23:09:08 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-12-01 23:09:08 -0500
commit5983fe2b29df5885880d7fa3b91aca306c7564ef (patch)
treec9d968a776b7d1f8dc446d2857f6cefddec6edb0 /net
parent5611cc4572e889b62a7b4c72a413536bf6a9c416 (diff)
parent3ced1be5490f5c415d51a1e5918beeb9239d546b (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (73 commits) netfilter: Remove ADVANCED dependency from NF_CONNTRACK_NETBIOS_NS ipv4: flush route cache after change accept_local sch_red: fix red_change Revert "udp: remove redundant variable" bridge: master device stuck in no-carrier state forever when in user-stp mode ipv4: Perform peer validation on cached route lookup. net/core: fix rollback handler in register_netdevice_notifier sch_red: fix red_calc_qavg_from_idle_time bonding: only use primary address for ARP ipv4: fix lockdep splat in rt_cache_seq_show sch_teql: fix lockdep splat net: fec: Select the FEC driver by default for i.MX SoCs isdn: avoid copying too long drvid isdn: make sure strings are null terminated netlabel: Fix build problems when IPv6 is not enabled sctp: better integer overflow check in sctp_auth_create_key() sctp: integer overflow in sctp_auth_create_key() ipv6: Set mcast_hops to IPV6_DEFAULT_MCASTHOPS when -1 was given. net: Fix corruption in /proc/*/net/dev_mcast mac80211: fix race between the AGG SM and the Tx data path ...
Diffstat (limited to 'net')
-rw-r--r--net/bridge/br_netlink.c6
-rw-r--r--net/bridge/br_stp.c29
-rw-r--r--net/caif/cffrml.c11
-rw-r--r--net/core/dev.c9
-rw-r--r--net/core/dev_addr_lists.c3
-rw-r--r--net/core/neighbour.c5
-rw-r--r--net/core/skbuff.c2
-rw-r--r--net/dccp/ipv4.c1
-rw-r--r--net/decnet/dn_route.c10
-rw-r--r--net/decnet/dn_timer.c17
-rw-r--r--net/ipv4/devinet.c5
-rw-r--r--net/ipv4/igmp.c3
-rw-r--r--net/ipv4/inet_diag.c14
-rw-r--r--net/ipv4/ip_forward.c2
-rw-r--r--net/ipv4/ip_options.c5
-rw-r--r--net/ipv4/netfilter.c3
-rw-r--r--net/ipv4/netfilter/Kconfig1
-rw-r--r--net/ipv4/route.c67
-rw-r--r--net/ipv4/udp.c15
-rw-r--r--net/ipv6/inet6_connection_sock.c2
-rw-r--r--net/ipv6/ipv6_sockglue.c2
-rw-r--r--net/ipv6/ndisc.c2
-rw-r--r--net/ipv6/netfilter/Kconfig1
-rw-r--r--net/ipv6/route.c21
-rw-r--r--net/ipv6/tcp_ipv6.c13
-rw-r--r--net/ipv6/udp.c15
-rw-r--r--net/l2tp/l2tp_core.c2
-rw-r--r--net/mac80211/agg-tx.c42
-rw-r--r--net/mac80211/debugfs_sta.c4
-rw-r--r--net/mac80211/status.c8
-rw-r--r--net/netfilter/Kconfig2
-rw-r--r--net/netfilter/ipset/ip_set_hash_ipport.c2
-rw-r--r--net/netfilter/ipset/ip_set_hash_ipportip.c2
-rw-r--r--net/netfilter/ipset/ip_set_hash_ipportnet.c2
-rw-r--r--net/netfilter/nf_conntrack_ecache.c37
-rw-r--r--net/netfilter/nf_conntrack_netlink.c73
-rw-r--r--net/netlabel/netlabel_kapi.c26
-rw-r--r--net/sched/sch_red.c4
-rw-r--r--net/sched/sch_teql.c31
-rw-r--r--net/sctp/auth.c2
-rw-r--r--net/unix/af_unix.c4
-rw-r--r--net/wireless/nl80211.c4
-rw-r--r--net/wireless/reg.c4
-rw-r--r--net/xfrm/xfrm_policy.c10
44 files changed, 337 insertions, 186 deletions
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index e5f9ece3c9a..a1daf8227ed 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -18,6 +18,7 @@
18#include <net/sock.h> 18#include <net/sock.h>
19 19
20#include "br_private.h" 20#include "br_private.h"
21#include "br_private_stp.h"
21 22
22static inline size_t br_nlmsg_size(void) 23static inline size_t br_nlmsg_size(void)
23{ 24{
@@ -188,6 +189,11 @@ static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
188 189
189 p->state = new_state; 190 p->state = new_state;
190 br_log_state(p); 191 br_log_state(p);
192
193 spin_lock_bh(&p->br->lock);
194 br_port_state_selection(p->br);
195 spin_unlock_bh(&p->br->lock);
196
191 br_ifinfo_notify(RTM_NEWLINK, p); 197 br_ifinfo_notify(RTM_NEWLINK, p);
192 198
193 return 0; 199 return 0;
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index ad0a3f7cf6c..dd147d78a58 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -399,25 +399,24 @@ void br_port_state_selection(struct net_bridge *br)
399 struct net_bridge_port *p; 399 struct net_bridge_port *p;
400 unsigned int liveports = 0; 400 unsigned int liveports = 0;
401 401
402 /* Don't change port states if userspace is handling STP */
403 if (br->stp_enabled == BR_USER_STP)
404 return;
405
406 list_for_each_entry(p, &br->port_list, list) { 402 list_for_each_entry(p, &br->port_list, list) {
407 if (p->state == BR_STATE_DISABLED) 403 if (p->state == BR_STATE_DISABLED)
408 continue; 404 continue;
409 405
410 if (p->port_no == br->root_port) { 406 /* Don't change port states if userspace is handling STP */
411 p->config_pending = 0; 407 if (br->stp_enabled != BR_USER_STP) {
412 p->topology_change_ack = 0; 408 if (p->port_no == br->root_port) {
413 br_make_forwarding(p); 409 p->config_pending = 0;
414 } else if (br_is_designated_port(p)) { 410 p->topology_change_ack = 0;
415 del_timer(&p->message_age_timer); 411 br_make_forwarding(p);
416 br_make_forwarding(p); 412 } else if (br_is_designated_port(p)) {
417 } else { 413 del_timer(&p->message_age_timer);
418 p->config_pending = 0; 414 br_make_forwarding(p);
419 p->topology_change_ack = 0; 415 } else {
420 br_make_blocking(p); 416 p->config_pending = 0;
417 p->topology_change_ack = 0;
418 br_make_blocking(p);
419 }
421 } 420 }
422 421
423 if (p->state == BR_STATE_FORWARDING) 422 if (p->state == BR_STATE_FORWARDING)
diff --git a/net/caif/cffrml.c b/net/caif/cffrml.c
index f39921171d0..d3ca87bf23b 100644
--- a/net/caif/cffrml.c
+++ b/net/caif/cffrml.c
@@ -136,20 +136,21 @@ static int cffrml_receive(struct cflayer *layr, struct cfpkt *pkt)
136 136
137static int cffrml_transmit(struct cflayer *layr, struct cfpkt *pkt) 137static int cffrml_transmit(struct cflayer *layr, struct cfpkt *pkt)
138{ 138{
139 int tmp;
140 u16 chks; 139 u16 chks;
141 u16 len; 140 u16 len;
141 __le16 data;
142
142 struct cffrml *this = container_obj(layr); 143 struct cffrml *this = container_obj(layr);
143 if (this->dofcs) { 144 if (this->dofcs) {
144 chks = cfpkt_iterate(pkt, cffrml_checksum, 0xffff); 145 chks = cfpkt_iterate(pkt, cffrml_checksum, 0xffff);
145 tmp = cpu_to_le16(chks); 146 data = cpu_to_le16(chks);
146 cfpkt_add_trail(pkt, &tmp, 2); 147 cfpkt_add_trail(pkt, &data, 2);
147 } else { 148 } else {
148 cfpkt_pad_trail(pkt, 2); 149 cfpkt_pad_trail(pkt, 2);
149 } 150 }
150 len = cfpkt_getlen(pkt); 151 len = cfpkt_getlen(pkt);
151 tmp = cpu_to_le16(len); 152 data = cpu_to_le16(len);
152 cfpkt_add_head(pkt, &tmp, 2); 153 cfpkt_add_head(pkt, &data, 2);
153 cfpkt_info(pkt)->hdr_len += 2; 154 cfpkt_info(pkt)->hdr_len += 2;
154 if (cfpkt_erroneous(pkt)) { 155 if (cfpkt_erroneous(pkt)) {
155 pr_err("Packet is erroneous!\n"); 156 pr_err("Packet is erroneous!\n");
diff --git a/net/core/dev.c b/net/core/dev.c
index 6ba50a1e404..5a13edfc9f7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1396,7 +1396,7 @@ rollback:
1396 for_each_net(net) { 1396 for_each_net(net) {
1397 for_each_netdev(net, dev) { 1397 for_each_netdev(net, dev) {
1398 if (dev == last) 1398 if (dev == last)
1399 break; 1399 goto outroll;
1400 1400
1401 if (dev->flags & IFF_UP) { 1401 if (dev->flags & IFF_UP) {
1402 nb->notifier_call(nb, NETDEV_GOING_DOWN, dev); 1402 nb->notifier_call(nb, NETDEV_GOING_DOWN, dev);
@@ -1407,6 +1407,7 @@ rollback:
1407 } 1407 }
1408 } 1408 }
1409 1409
1410outroll:
1410 raw_notifier_chain_unregister(&netdev_chain, nb); 1411 raw_notifier_chain_unregister(&netdev_chain, nb);
1411 goto unlock; 1412 goto unlock;
1412} 1413}
@@ -4282,6 +4283,12 @@ static int dev_seq_open(struct inode *inode, struct file *file)
4282 sizeof(struct dev_iter_state)); 4283 sizeof(struct dev_iter_state));
4283} 4284}
4284 4285
4286int dev_seq_open_ops(struct inode *inode, struct file *file,
4287 const struct seq_operations *ops)
4288{
4289 return seq_open_net(inode, file, ops, sizeof(struct dev_iter_state));
4290}
4291
4285static const struct file_operations dev_seq_fops = { 4292static const struct file_operations dev_seq_fops = {
4286 .owner = THIS_MODULE, 4293 .owner = THIS_MODULE,
4287 .open = dev_seq_open, 4294 .open = dev_seq_open,
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
index 277faef9148..febba516db6 100644
--- a/net/core/dev_addr_lists.c
+++ b/net/core/dev_addr_lists.c
@@ -696,8 +696,7 @@ static const struct seq_operations dev_mc_seq_ops = {
696 696
697static int dev_mc_seq_open(struct inode *inode, struct file *file) 697static int dev_mc_seq_open(struct inode *inode, struct file *file)
698{ 698{
699 return seq_open_net(inode, file, &dev_mc_seq_ops, 699 return dev_seq_open_ops(inode, file, &dev_mc_seq_ops);
700 sizeof(struct seq_net_private));
701} 700}
702 701
703static const struct file_operations dev_mc_seq_fops = { 702static const struct file_operations dev_mc_seq_fops = {
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 039d51e6c28..5ac07d31fbc 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2397,7 +2397,10 @@ static struct pneigh_entry *pneigh_get_next(struct seq_file *seq,
2397 struct net *net = seq_file_net(seq); 2397 struct net *net = seq_file_net(seq);
2398 struct neigh_table *tbl = state->tbl; 2398 struct neigh_table *tbl = state->tbl;
2399 2399
2400 pn = pn->next; 2400 do {
2401 pn = pn->next;
2402 } while (pn && !net_eq(pneigh_net(pn), net));
2403
2401 while (!pn) { 2404 while (!pn) {
2402 if (++state->bucket > PNEIGH_HASHMASK) 2405 if (++state->bucket > PNEIGH_HASHMASK)
2403 break; 2406 break;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 18a3cebb753..3c30ee4a571 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2230,7 +2230,7 @@ static int skb_prepare_for_shift(struct sk_buff *skb)
2230 * @shiftlen: shift up to this many bytes 2230 * @shiftlen: shift up to this many bytes
2231 * 2231 *
2232 * Attempts to shift up to shiftlen worth of bytes, which may be less than 2232 * Attempts to shift up to shiftlen worth of bytes, which may be less than
2233 * the length of the skb, from tgt to skb. Returns number bytes shifted. 2233 * the length of the skb, from skb to tgt. Returns number bytes shifted.
2234 * It's up to caller to free skb if everything was shifted. 2234 * It's up to caller to free skb if everything was shifted.
2235 * 2235 *
2236 * If @tgt runs out of frags, the whole operation is aborted. 2236 * If @tgt runs out of frags, the whole operation is aborted.
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 90a919afbed..3f4e5414c8e 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -111,6 +111,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
111 rt = ip_route_newports(fl4, rt, orig_sport, orig_dport, 111 rt = ip_route_newports(fl4, rt, orig_sport, orig_dport,
112 inet->inet_sport, inet->inet_dport, sk); 112 inet->inet_sport, inet->inet_dport, sk);
113 if (IS_ERR(rt)) { 113 if (IS_ERR(rt)) {
114 err = PTR_ERR(rt);
114 rt = NULL; 115 rt = NULL;
115 goto failure; 116 goto failure;
116 } 117 }
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index a77d16158eb..94f4ec03666 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -112,7 +112,7 @@ static unsigned long dn_rt_deadline;
112static int dn_dst_gc(struct dst_ops *ops); 112static int dn_dst_gc(struct dst_ops *ops);
113static struct dst_entry *dn_dst_check(struct dst_entry *, __u32); 113static struct dst_entry *dn_dst_check(struct dst_entry *, __u32);
114static unsigned int dn_dst_default_advmss(const struct dst_entry *dst); 114static unsigned int dn_dst_default_advmss(const struct dst_entry *dst);
115static unsigned int dn_dst_default_mtu(const struct dst_entry *dst); 115static unsigned int dn_dst_mtu(const struct dst_entry *dst);
116static void dn_dst_destroy(struct dst_entry *); 116static void dn_dst_destroy(struct dst_entry *);
117static struct dst_entry *dn_dst_negative_advice(struct dst_entry *); 117static struct dst_entry *dn_dst_negative_advice(struct dst_entry *);
118static void dn_dst_link_failure(struct sk_buff *); 118static void dn_dst_link_failure(struct sk_buff *);
@@ -135,7 +135,7 @@ static struct dst_ops dn_dst_ops = {
135 .gc = dn_dst_gc, 135 .gc = dn_dst_gc,
136 .check = dn_dst_check, 136 .check = dn_dst_check,
137 .default_advmss = dn_dst_default_advmss, 137 .default_advmss = dn_dst_default_advmss,
138 .default_mtu = dn_dst_default_mtu, 138 .mtu = dn_dst_mtu,
139 .cow_metrics = dst_cow_metrics_generic, 139 .cow_metrics = dst_cow_metrics_generic,
140 .destroy = dn_dst_destroy, 140 .destroy = dn_dst_destroy,
141 .negative_advice = dn_dst_negative_advice, 141 .negative_advice = dn_dst_negative_advice,
@@ -825,9 +825,11 @@ static unsigned int dn_dst_default_advmss(const struct dst_entry *dst)
825 return dn_mss_from_pmtu(dst->dev, dst_mtu(dst)); 825 return dn_mss_from_pmtu(dst->dev, dst_mtu(dst));
826} 826}
827 827
828static unsigned int dn_dst_default_mtu(const struct dst_entry *dst) 828static unsigned int dn_dst_mtu(const struct dst_entry *dst)
829{ 829{
830 return dst->dev->mtu; 830 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
831
832 return mtu ? : dst->dev->mtu;
831} 833}
832 834
833static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr) 835static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
diff --git a/net/decnet/dn_timer.c b/net/decnet/dn_timer.c
index 67f691bd4ac..d9c150cc59a 100644
--- a/net/decnet/dn_timer.c
+++ b/net/decnet/dn_timer.c
@@ -36,16 +36,13 @@ static void dn_slow_timer(unsigned long arg);
36 36
37void dn_start_slow_timer(struct sock *sk) 37void dn_start_slow_timer(struct sock *sk)
38{ 38{
39 sk->sk_timer.expires = jiffies + SLOW_INTERVAL; 39 setup_timer(&sk->sk_timer, dn_slow_timer, (unsigned long)sk);
40 sk->sk_timer.function = dn_slow_timer; 40 sk_reset_timer(sk, &sk->sk_timer, jiffies + SLOW_INTERVAL);
41 sk->sk_timer.data = (unsigned long)sk;
42
43 add_timer(&sk->sk_timer);
44} 41}
45 42
46void dn_stop_slow_timer(struct sock *sk) 43void dn_stop_slow_timer(struct sock *sk)
47{ 44{
48 del_timer(&sk->sk_timer); 45 sk_stop_timer(sk, &sk->sk_timer);
49} 46}
50 47
51static void dn_slow_timer(unsigned long arg) 48static void dn_slow_timer(unsigned long arg)
@@ -53,12 +50,10 @@ static void dn_slow_timer(unsigned long arg)
53 struct sock *sk = (struct sock *)arg; 50 struct sock *sk = (struct sock *)arg;
54 struct dn_scp *scp = DN_SK(sk); 51 struct dn_scp *scp = DN_SK(sk);
55 52
56 sock_hold(sk);
57 bh_lock_sock(sk); 53 bh_lock_sock(sk);
58 54
59 if (sock_owned_by_user(sk)) { 55 if (sock_owned_by_user(sk)) {
60 sk->sk_timer.expires = jiffies + HZ / 10; 56 sk_reset_timer(sk, &sk->sk_timer, jiffies + HZ / 10);
61 add_timer(&sk->sk_timer);
62 goto out; 57 goto out;
63 } 58 }
64 59
@@ -100,9 +95,7 @@ static void dn_slow_timer(unsigned long arg)
100 scp->keepalive_fxn(sk); 95 scp->keepalive_fxn(sk);
101 } 96 }
102 97
103 sk->sk_timer.expires = jiffies + SLOW_INTERVAL; 98 sk_reset_timer(sk, &sk->sk_timer, jiffies + SLOW_INTERVAL);
104
105 add_timer(&sk->sk_timer);
106out: 99out:
107 bh_unlock_sock(sk); 100 bh_unlock_sock(sk);
108 sock_put(sk); 101 sock_put(sk);
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index c6b5092f29a..65f01dc4756 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1490,7 +1490,9 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
1490 void __user *buffer, 1490 void __user *buffer,
1491 size_t *lenp, loff_t *ppos) 1491 size_t *lenp, loff_t *ppos)
1492{ 1492{
1493 int old_value = *(int *)ctl->data;
1493 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); 1494 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
1495 int new_value = *(int *)ctl->data;
1494 1496
1495 if (write) { 1497 if (write) {
1496 struct ipv4_devconf *cnf = ctl->extra1; 1498 struct ipv4_devconf *cnf = ctl->extra1;
@@ -1501,6 +1503,9 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
1501 1503
1502 if (cnf == net->ipv4.devconf_dflt) 1504 if (cnf == net->ipv4.devconf_dflt)
1503 devinet_copy_dflt_conf(net, i); 1505 devinet_copy_dflt_conf(net, i);
1506 if (i == IPV4_DEVCONF_ACCEPT_LOCAL - 1)
1507 if ((new_value == 0) && (old_value != 0))
1508 rt_cache_flush(net, 0);
1504 } 1509 }
1505 1510
1506 return ret; 1511 return ret;
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index c7472eff2d5..b2ca095cb9d 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1716,7 +1716,8 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
1716 if (err) { 1716 if (err) {
1717 int j; 1717 int j;
1718 1718
1719 pmc->sfcount[sfmode]--; 1719 if (!delta)
1720 pmc->sfcount[sfmode]--;
1720 for (j=0; j<i; j++) 1721 for (j=0; j<i; j++)
1721 (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[j]); 1722 (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[j]);
1722 } else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) { 1723 } else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) {
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 68e8ac51438..ccee270a9b6 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -108,9 +108,6 @@ static int inet_csk_diag_fill(struct sock *sk,
108 icsk->icsk_ca_ops->name); 108 icsk->icsk_ca_ops->name);
109 } 109 }
110 110
111 if ((ext & (1 << (INET_DIAG_TOS - 1))) && (sk->sk_family != AF_INET6))
112 RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos);
113
114 r->idiag_family = sk->sk_family; 111 r->idiag_family = sk->sk_family;
115 r->idiag_state = sk->sk_state; 112 r->idiag_state = sk->sk_state;
116 r->idiag_timer = 0; 113 r->idiag_timer = 0;
@@ -125,16 +122,23 @@ static int inet_csk_diag_fill(struct sock *sk,
125 r->id.idiag_src[0] = inet->inet_rcv_saddr; 122 r->id.idiag_src[0] = inet->inet_rcv_saddr;
126 r->id.idiag_dst[0] = inet->inet_daddr; 123 r->id.idiag_dst[0] = inet->inet_daddr;
127 124
125 /* IPv6 dual-stack sockets use inet->tos for IPv4 connections,
126 * hence this needs to be included regardless of socket family.
127 */
128 if (ext & (1 << (INET_DIAG_TOS - 1)))
129 RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos);
130
128#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 131#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
129 if (r->idiag_family == AF_INET6) { 132 if (r->idiag_family == AF_INET6) {
130 const struct ipv6_pinfo *np = inet6_sk(sk); 133 const struct ipv6_pinfo *np = inet6_sk(sk);
131 134
135 if (ext & (1 << (INET_DIAG_TCLASS - 1)))
136 RTA_PUT_U8(skb, INET_DIAG_TCLASS, np->tclass);
137
132 ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, 138 ipv6_addr_copy((struct in6_addr *)r->id.idiag_src,
133 &np->rcv_saddr); 139 &np->rcv_saddr);
134 ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, 140 ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst,
135 &np->daddr); 141 &np->daddr);
136 if (ext & (1 << (INET_DIAG_TCLASS - 1)))
137 RTA_PUT_U8(skb, INET_DIAG_TCLASS, np->tclass);
138 } 142 }
139#endif 143#endif
140 144
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 3b34d1c8627..29a07b6c716 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -84,7 +84,7 @@ int ip_forward(struct sk_buff *skb)
84 84
85 rt = skb_rtable(skb); 85 rt = skb_rtable(skb);
86 86
87 if (opt->is_strictroute && ip_hdr(skb)->daddr != rt->rt_gateway) 87 if (opt->is_strictroute && opt->nexthop != rt->rt_gateway)
88 goto sr_failed; 88 goto sr_failed;
89 89
90 if (unlikely(skb->len > dst_mtu(&rt->dst) && !skb_is_gso(skb) && 90 if (unlikely(skb->len > dst_mtu(&rt->dst) && !skb_is_gso(skb) &&
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index 05d20cca9d6..1e60f767907 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -568,12 +568,13 @@ void ip_forward_options(struct sk_buff *skb)
568 ) { 568 ) {
569 if (srrptr + 3 > srrspace) 569 if (srrptr + 3 > srrspace)
570 break; 570 break;
571 if (memcmp(&ip_hdr(skb)->daddr, &optptr[srrptr-1], 4) == 0) 571 if (memcmp(&opt->nexthop, &optptr[srrptr-1], 4) == 0)
572 break; 572 break;
573 } 573 }
574 if (srrptr + 3 <= srrspace) { 574 if (srrptr + 3 <= srrspace) {
575 opt->is_changed = 1; 575 opt->is_changed = 1;
576 ip_rt_get_source(&optptr[srrptr-1], skb, rt); 576 ip_rt_get_source(&optptr[srrptr-1], skb, rt);
577 ip_hdr(skb)->daddr = opt->nexthop;
577 optptr[2] = srrptr+4; 578 optptr[2] = srrptr+4;
578 } else if (net_ratelimit()) 579 } else if (net_ratelimit())
579 printk(KERN_CRIT "ip_forward(): Argh! Destination lost!\n"); 580 printk(KERN_CRIT "ip_forward(): Argh! Destination lost!\n");
@@ -640,7 +641,7 @@ int ip_options_rcv_srr(struct sk_buff *skb)
640 } 641 }
641 if (srrptr <= srrspace) { 642 if (srrptr <= srrspace) {
642 opt->srr_is_hit = 1; 643 opt->srr_is_hit = 1;
643 iph->daddr = nexthop; 644 opt->nexthop = nexthop;
644 opt->is_changed = 1; 645 opt->is_changed = 1;
645 } 646 }
646 return 0; 647 return 0;
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c
index 9899619ab9b..4f47e064e26 100644
--- a/net/ipv4/netfilter.c
+++ b/net/ipv4/netfilter.c
@@ -64,7 +64,8 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type)
64 /* Change in oif may mean change in hh_len. */ 64 /* Change in oif may mean change in hh_len. */
65 hh_len = skb_dst(skb)->dev->hard_header_len; 65 hh_len = skb_dst(skb)->dev->hard_header_len;
66 if (skb_headroom(skb) < hh_len && 66 if (skb_headroom(skb) < hh_len &&
67 pskb_expand_head(skb, hh_len - skb_headroom(skb), 0, GFP_ATOMIC)) 67 pskb_expand_head(skb, HH_DATA_ALIGN(hh_len - skb_headroom(skb)),
68 0, GFP_ATOMIC))
68 return -1; 69 return -1;
69 70
70 return 0; 71 return 0;
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
index 1dfc18a03fd..f19f2182894 100644
--- a/net/ipv4/netfilter/Kconfig
+++ b/net/ipv4/netfilter/Kconfig
@@ -325,7 +325,6 @@ config IP_NF_TARGET_TTL
325# raw + specific targets 325# raw + specific targets
326config IP_NF_RAW 326config IP_NF_RAW
327 tristate 'raw table support (required for NOTRACK/TRACE)' 327 tristate 'raw table support (required for NOTRACK/TRACE)'
328 depends on NETFILTER_ADVANCED
329 help 328 help
330 This option adds a `raw' table to iptables. This table is the very 329 This option adds a `raw' table to iptables. This table is the very
331 first in the netfilter framework and hooks in at the PREROUTING 330 first in the netfilter framework and hooks in at the PREROUTING
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 0c74da8a047..ca5e237df02 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -131,6 +131,7 @@ static int ip_rt_mtu_expires __read_mostly = 10 * 60 * HZ;
131static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; 131static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20;
132static int ip_rt_min_advmss __read_mostly = 256; 132static int ip_rt_min_advmss __read_mostly = 256;
133static int rt_chain_length_max __read_mostly = 20; 133static int rt_chain_length_max __read_mostly = 20;
134static int redirect_genid;
134 135
135/* 136/*
136 * Interface to generic destination cache. 137 * Interface to generic destination cache.
@@ -138,7 +139,7 @@ static int rt_chain_length_max __read_mostly = 20;
138 139
139static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie); 140static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie);
140static unsigned int ipv4_default_advmss(const struct dst_entry *dst); 141static unsigned int ipv4_default_advmss(const struct dst_entry *dst);
141static unsigned int ipv4_default_mtu(const struct dst_entry *dst); 142static unsigned int ipv4_mtu(const struct dst_entry *dst);
142static void ipv4_dst_destroy(struct dst_entry *dst); 143static void ipv4_dst_destroy(struct dst_entry *dst);
143static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst); 144static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst);
144static void ipv4_link_failure(struct sk_buff *skb); 145static void ipv4_link_failure(struct sk_buff *skb);
@@ -193,7 +194,7 @@ static struct dst_ops ipv4_dst_ops = {
193 .gc = rt_garbage_collect, 194 .gc = rt_garbage_collect,
194 .check = ipv4_dst_check, 195 .check = ipv4_dst_check,
195 .default_advmss = ipv4_default_advmss, 196 .default_advmss = ipv4_default_advmss,
196 .default_mtu = ipv4_default_mtu, 197 .mtu = ipv4_mtu,
197 .cow_metrics = ipv4_cow_metrics, 198 .cow_metrics = ipv4_cow_metrics,
198 .destroy = ipv4_dst_destroy, 199 .destroy = ipv4_dst_destroy,
199 .ifdown = ipv4_dst_ifdown, 200 .ifdown = ipv4_dst_ifdown,
@@ -416,9 +417,13 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
416 else { 417 else {
417 struct rtable *r = v; 418 struct rtable *r = v;
418 struct neighbour *n; 419 struct neighbour *n;
419 int len; 420 int len, HHUptod;
420 421
422 rcu_read_lock();
421 n = dst_get_neighbour(&r->dst); 423 n = dst_get_neighbour(&r->dst);
424 HHUptod = (n && (n->nud_state & NUD_CONNECTED)) ? 1 : 0;
425 rcu_read_unlock();
426
422 seq_printf(seq, "%s\t%08X\t%08X\t%8X\t%d\t%u\t%d\t" 427 seq_printf(seq, "%s\t%08X\t%08X\t%8X\t%d\t%u\t%d\t"
423 "%08X\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n", 428 "%08X\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n",
424 r->dst.dev ? r->dst.dev->name : "*", 429 r->dst.dev ? r->dst.dev->name : "*",
@@ -432,7 +437,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
432 dst_metric(&r->dst, RTAX_RTTVAR)), 437 dst_metric(&r->dst, RTAX_RTTVAR)),
433 r->rt_key_tos, 438 r->rt_key_tos,
434 -1, 439 -1,
435 (n && (n->nud_state & NUD_CONNECTED)) ? 1 : 0, 440 HHUptod,
436 r->rt_spec_dst, &len); 441 r->rt_spec_dst, &len);
437 442
438 seq_printf(seq, "%*s\n", 127 - len, ""); 443 seq_printf(seq, "%*s\n", 127 - len, "");
@@ -837,6 +842,7 @@ static void rt_cache_invalidate(struct net *net)
837 842
838 get_random_bytes(&shuffle, sizeof(shuffle)); 843 get_random_bytes(&shuffle, sizeof(shuffle));
839 atomic_add(shuffle + 1U, &net->ipv4.rt_genid); 844 atomic_add(shuffle + 1U, &net->ipv4.rt_genid);
845 redirect_genid++;
840} 846}
841 847
842/* 848/*
@@ -1391,8 +1397,10 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
1391 1397
1392 peer = rt->peer; 1398 peer = rt->peer;
1393 if (peer) { 1399 if (peer) {
1394 if (peer->redirect_learned.a4 != new_gw) { 1400 if (peer->redirect_learned.a4 != new_gw ||
1401 peer->redirect_genid != redirect_genid) {
1395 peer->redirect_learned.a4 = new_gw; 1402 peer->redirect_learned.a4 = new_gw;
1403 peer->redirect_genid = redirect_genid;
1396 atomic_inc(&__rt_peer_genid); 1404 atomic_inc(&__rt_peer_genid);
1397 } 1405 }
1398 check_peer_redir(&rt->dst, peer); 1406 check_peer_redir(&rt->dst, peer);
@@ -1685,12 +1693,8 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu)
1685} 1693}
1686 1694
1687 1695
1688static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) 1696static struct rtable *ipv4_validate_peer(struct rtable *rt)
1689{ 1697{
1690 struct rtable *rt = (struct rtable *) dst;
1691
1692 if (rt_is_expired(rt))
1693 return NULL;
1694 if (rt->rt_peer_genid != rt_peer_genid()) { 1698 if (rt->rt_peer_genid != rt_peer_genid()) {
1695 struct inet_peer *peer; 1699 struct inet_peer *peer;
1696 1700
@@ -1699,17 +1703,29 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
1699 1703
1700 peer = rt->peer; 1704 peer = rt->peer;
1701 if (peer) { 1705 if (peer) {
1702 check_peer_pmtu(dst, peer); 1706 check_peer_pmtu(&rt->dst, peer);
1703 1707
1708 if (peer->redirect_genid != redirect_genid)
1709 peer->redirect_learned.a4 = 0;
1704 if (peer->redirect_learned.a4 && 1710 if (peer->redirect_learned.a4 &&
1705 peer->redirect_learned.a4 != rt->rt_gateway) { 1711 peer->redirect_learned.a4 != rt->rt_gateway) {
1706 if (check_peer_redir(dst, peer)) 1712 if (check_peer_redir(&rt->dst, peer))
1707 return NULL; 1713 return NULL;
1708 } 1714 }
1709 } 1715 }
1710 1716
1711 rt->rt_peer_genid = rt_peer_genid(); 1717 rt->rt_peer_genid = rt_peer_genid();
1712 } 1718 }
1719 return rt;
1720}
1721
1722static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
1723{
1724 struct rtable *rt = (struct rtable *) dst;
1725
1726 if (rt_is_expired(rt))
1727 return NULL;
1728 dst = (struct dst_entry *) ipv4_validate_peer(rt);
1713 return dst; 1729 return dst;
1714} 1730}
1715 1731
@@ -1814,12 +1830,17 @@ static unsigned int ipv4_default_advmss(const struct dst_entry *dst)
1814 return advmss; 1830 return advmss;
1815} 1831}
1816 1832
1817static unsigned int ipv4_default_mtu(const struct dst_entry *dst) 1833static unsigned int ipv4_mtu(const struct dst_entry *dst)
1818{ 1834{
1819 unsigned int mtu = dst->dev->mtu; 1835 const struct rtable *rt = (const struct rtable *) dst;
1836 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
1837
1838 if (mtu && rt_is_output_route(rt))
1839 return mtu;
1840
1841 mtu = dst->dev->mtu;
1820 1842
1821 if (unlikely(dst_metric_locked(dst, RTAX_MTU))) { 1843 if (unlikely(dst_metric_locked(dst, RTAX_MTU))) {
1822 const struct rtable *rt = (const struct rtable *) dst;
1823 1844
1824 if (rt->rt_gateway != rt->rt_dst && mtu > 576) 1845 if (rt->rt_gateway != rt->rt_dst && mtu > 576)
1825 mtu = 576; 1846 mtu = 576;
@@ -1852,6 +1873,8 @@ static void rt_init_metrics(struct rtable *rt, const struct flowi4 *fl4,
1852 dst_init_metrics(&rt->dst, peer->metrics, false); 1873 dst_init_metrics(&rt->dst, peer->metrics, false);
1853 1874
1854 check_peer_pmtu(&rt->dst, peer); 1875 check_peer_pmtu(&rt->dst, peer);
1876 if (peer->redirect_genid != redirect_genid)
1877 peer->redirect_learned.a4 = 0;
1855 if (peer->redirect_learned.a4 && 1878 if (peer->redirect_learned.a4 &&
1856 peer->redirect_learned.a4 != rt->rt_gateway) { 1879 peer->redirect_learned.a4 != rt->rt_gateway) {
1857 rt->rt_gateway = peer->redirect_learned.a4; 1880 rt->rt_gateway = peer->redirect_learned.a4;
@@ -2357,6 +2380,9 @@ int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2357 rth->rt_mark == skb->mark && 2380 rth->rt_mark == skb->mark &&
2358 net_eq(dev_net(rth->dst.dev), net) && 2381 net_eq(dev_net(rth->dst.dev), net) &&
2359 !rt_is_expired(rth)) { 2382 !rt_is_expired(rth)) {
2383 rth = ipv4_validate_peer(rth);
2384 if (!rth)
2385 continue;
2360 if (noref) { 2386 if (noref) {
2361 dst_use_noref(&rth->dst, jiffies); 2387 dst_use_noref(&rth->dst, jiffies);
2362 skb_dst_set_noref(skb, &rth->dst); 2388 skb_dst_set_noref(skb, &rth->dst);
@@ -2732,6 +2758,9 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *flp4)
2732 (IPTOS_RT_MASK | RTO_ONLINK)) && 2758 (IPTOS_RT_MASK | RTO_ONLINK)) &&
2733 net_eq(dev_net(rth->dst.dev), net) && 2759 net_eq(dev_net(rth->dst.dev), net) &&
2734 !rt_is_expired(rth)) { 2760 !rt_is_expired(rth)) {
2761 rth = ipv4_validate_peer(rth);
2762 if (!rth)
2763 continue;
2735 dst_use(&rth->dst, jiffies); 2764 dst_use(&rth->dst, jiffies);
2736 RT_CACHE_STAT_INC(out_hit); 2765 RT_CACHE_STAT_INC(out_hit);
2737 rcu_read_unlock_bh(); 2766 rcu_read_unlock_bh();
@@ -2755,9 +2784,11 @@ static struct dst_entry *ipv4_blackhole_dst_check(struct dst_entry *dst, u32 coo
2755 return NULL; 2784 return NULL;
2756} 2785}
2757 2786
2758static unsigned int ipv4_blackhole_default_mtu(const struct dst_entry *dst) 2787static unsigned int ipv4_blackhole_mtu(const struct dst_entry *dst)
2759{ 2788{
2760 return 0; 2789 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
2790
2791 return mtu ? : dst->dev->mtu;
2761} 2792}
2762 2793
2763static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) 2794static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu)
@@ -2775,7 +2806,7 @@ static struct dst_ops ipv4_dst_blackhole_ops = {
2775 .protocol = cpu_to_be16(ETH_P_IP), 2806 .protocol = cpu_to_be16(ETH_P_IP),
2776 .destroy = ipv4_dst_destroy, 2807 .destroy = ipv4_dst_destroy,
2777 .check = ipv4_blackhole_dst_check, 2808 .check = ipv4_blackhole_dst_check,
2778 .default_mtu = ipv4_blackhole_default_mtu, 2809 .mtu = ipv4_blackhole_mtu,
2779 .default_advmss = ipv4_default_advmss, 2810 .default_advmss = ipv4_default_advmss,
2780 .update_pmtu = ipv4_rt_blackhole_update_pmtu, 2811 .update_pmtu = ipv4_rt_blackhole_update_pmtu,
2781 .cow_metrics = ipv4_rt_blackhole_cow_metrics, 2812 .cow_metrics = ipv4_rt_blackhole_cow_metrics,
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index ab0966df1e2..5a65eeac1d2 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1164,7 +1164,7 @@ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
1164 struct inet_sock *inet = inet_sk(sk); 1164 struct inet_sock *inet = inet_sk(sk);
1165 struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name; 1165 struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name;
1166 struct sk_buff *skb; 1166 struct sk_buff *skb;
1167 unsigned int ulen; 1167 unsigned int ulen, copied;
1168 int peeked; 1168 int peeked;
1169 int err; 1169 int err;
1170 int is_udplite = IS_UDPLITE(sk); 1170 int is_udplite = IS_UDPLITE(sk);
@@ -1186,9 +1186,10 @@ try_again:
1186 goto out; 1186 goto out;
1187 1187
1188 ulen = skb->len - sizeof(struct udphdr); 1188 ulen = skb->len - sizeof(struct udphdr);
1189 if (len > ulen) 1189 copied = len;
1190 len = ulen; 1190 if (copied > ulen)
1191 else if (len < ulen) 1191 copied = ulen;
1192 else if (copied < ulen)
1192 msg->msg_flags |= MSG_TRUNC; 1193 msg->msg_flags |= MSG_TRUNC;
1193 1194
1194 /* 1195 /*
@@ -1197,14 +1198,14 @@ try_again:
1197 * coverage checksum (UDP-Lite), do it before the copy. 1198 * coverage checksum (UDP-Lite), do it before the copy.
1198 */ 1199 */
1199 1200
1200 if (len < ulen || UDP_SKB_CB(skb)->partial_cov) { 1201 if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) {
1201 if (udp_lib_checksum_complete(skb)) 1202 if (udp_lib_checksum_complete(skb))
1202 goto csum_copy_err; 1203 goto csum_copy_err;
1203 } 1204 }
1204 1205
1205 if (skb_csum_unnecessary(skb)) 1206 if (skb_csum_unnecessary(skb))
1206 err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), 1207 err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),
1207 msg->msg_iov, len); 1208 msg->msg_iov, copied);
1208 else { 1209 else {
1209 err = skb_copy_and_csum_datagram_iovec(skb, 1210 err = skb_copy_and_csum_datagram_iovec(skb,
1210 sizeof(struct udphdr), 1211 sizeof(struct udphdr),
@@ -1233,7 +1234,7 @@ try_again:
1233 if (inet->cmsg_flags) 1234 if (inet->cmsg_flags)
1234 ip_cmsg_recv(msg, skb); 1235 ip_cmsg_recv(msg, skb);
1235 1236
1236 err = len; 1237 err = copied;
1237 if (flags & MSG_TRUNC) 1238 if (flags & MSG_TRUNC)
1238 err = ulen; 1239 err = ulen;
1239 1240
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index fee46d5a2f1..1567fb12039 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -85,7 +85,7 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk,
85 * request_sock (formerly open request) hash tables. 85 * request_sock (formerly open request) hash tables.
86 */ 86 */
87static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport, 87static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport,
88 const u32 rnd, const u16 synq_hsize) 88 const u32 rnd, const u32 synq_hsize)
89{ 89{
90 u32 c; 90 u32 c;
91 91
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index c99e3ee9781..26cb08c84b7 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -503,7 +503,7 @@ done:
503 goto e_inval; 503 goto e_inval;
504 if (val > 255 || val < -1) 504 if (val > 255 || val < -1)
505 goto e_inval; 505 goto e_inval;
506 np->mcast_hops = val; 506 np->mcast_hops = (val == -1 ? IPV6_DEFAULT_MCASTHOPS : val);
507 retv = 0; 507 retv = 0;
508 break; 508 break;
509 509
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 44e5b7f2a6c..0cb78d7ddaf 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1571,7 +1571,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1571 } 1571 }
1572 if (!rt->rt6i_peer) 1572 if (!rt->rt6i_peer)
1573 rt6_bind_peer(rt, 1); 1573 rt6_bind_peer(rt, 1);
1574 if (inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ)) 1574 if (!inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ))
1575 goto release; 1575 goto release;
1576 1576
1577 if (dev->addr_len) { 1577 if (dev->addr_len) {
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig
index 448464844a2..f792b34cbe9 100644
--- a/net/ipv6/netfilter/Kconfig
+++ b/net/ipv6/netfilter/Kconfig
@@ -186,7 +186,6 @@ config IP6_NF_MANGLE
186 186
187config IP6_NF_RAW 187config IP6_NF_RAW
188 tristate 'raw table support (required for TRACE)' 188 tristate 'raw table support (required for TRACE)'
189 depends on NETFILTER_ADVANCED
190 help 189 help
191 This option adds a `raw' table to ip6tables. This table is the very 190 This option adds a `raw' table to ip6tables. This table is the very
192 first in the netfilter framework and hooks in at the PREROUTING 191 first in the netfilter framework and hooks in at the PREROUTING
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 8473016bba4..3399dd32628 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -77,7 +77,7 @@ static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort,
77 const struct in6_addr *dest); 77 const struct in6_addr *dest);
78static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); 78static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie);
79static unsigned int ip6_default_advmss(const struct dst_entry *dst); 79static unsigned int ip6_default_advmss(const struct dst_entry *dst);
80static unsigned int ip6_default_mtu(const struct dst_entry *dst); 80static unsigned int ip6_mtu(const struct dst_entry *dst);
81static struct dst_entry *ip6_negative_advice(struct dst_entry *); 81static struct dst_entry *ip6_negative_advice(struct dst_entry *);
82static void ip6_dst_destroy(struct dst_entry *); 82static void ip6_dst_destroy(struct dst_entry *);
83static void ip6_dst_ifdown(struct dst_entry *, 83static void ip6_dst_ifdown(struct dst_entry *,
@@ -144,7 +144,7 @@ static struct dst_ops ip6_dst_ops_template = {
144 .gc_thresh = 1024, 144 .gc_thresh = 1024,
145 .check = ip6_dst_check, 145 .check = ip6_dst_check,
146 .default_advmss = ip6_default_advmss, 146 .default_advmss = ip6_default_advmss,
147 .default_mtu = ip6_default_mtu, 147 .mtu = ip6_mtu,
148 .cow_metrics = ipv6_cow_metrics, 148 .cow_metrics = ipv6_cow_metrics,
149 .destroy = ip6_dst_destroy, 149 .destroy = ip6_dst_destroy,
150 .ifdown = ip6_dst_ifdown, 150 .ifdown = ip6_dst_ifdown,
@@ -155,9 +155,11 @@ static struct dst_ops ip6_dst_ops_template = {
155 .neigh_lookup = ip6_neigh_lookup, 155 .neigh_lookup = ip6_neigh_lookup,
156}; 156};
157 157
158static unsigned int ip6_blackhole_default_mtu(const struct dst_entry *dst) 158static unsigned int ip6_blackhole_mtu(const struct dst_entry *dst)
159{ 159{
160 return 0; 160 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
161
162 return mtu ? : dst->dev->mtu;
161} 163}
162 164
163static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) 165static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu)
@@ -175,7 +177,7 @@ static struct dst_ops ip6_dst_blackhole_ops = {
175 .protocol = cpu_to_be16(ETH_P_IPV6), 177 .protocol = cpu_to_be16(ETH_P_IPV6),
176 .destroy = ip6_dst_destroy, 178 .destroy = ip6_dst_destroy,
177 .check = ip6_dst_check, 179 .check = ip6_dst_check,
178 .default_mtu = ip6_blackhole_default_mtu, 180 .mtu = ip6_blackhole_mtu,
179 .default_advmss = ip6_default_advmss, 181 .default_advmss = ip6_default_advmss,
180 .update_pmtu = ip6_rt_blackhole_update_pmtu, 182 .update_pmtu = ip6_rt_blackhole_update_pmtu,
181 .cow_metrics = ip6_rt_blackhole_cow_metrics, 183 .cow_metrics = ip6_rt_blackhole_cow_metrics,
@@ -1041,10 +1043,15 @@ static unsigned int ip6_default_advmss(const struct dst_entry *dst)
1041 return mtu; 1043 return mtu;
1042} 1044}
1043 1045
1044static unsigned int ip6_default_mtu(const struct dst_entry *dst) 1046static unsigned int ip6_mtu(const struct dst_entry *dst)
1045{ 1047{
1046 unsigned int mtu = IPV6_MIN_MTU;
1047 struct inet6_dev *idev; 1048 struct inet6_dev *idev;
1049 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
1050
1051 if (mtu)
1052 return mtu;
1053
1054 mtu = IPV6_MIN_MTU;
1048 1055
1049 rcu_read_lock(); 1056 rcu_read_lock();
1050 idev = __in6_dev_get(dst->dev); 1057 idev = __in6_dev_get(dst->dev);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 36131d122a6..2dea4bb7b54 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1255,6 +1255,13 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
1255 if (!want_cookie || tmp_opt.tstamp_ok) 1255 if (!want_cookie || tmp_opt.tstamp_ok)
1256 TCP_ECN_create_request(req, tcp_hdr(skb)); 1256 TCP_ECN_create_request(req, tcp_hdr(skb));
1257 1257
1258 treq->iif = sk->sk_bound_dev_if;
1259
1260 /* So that link locals have meaning */
1261 if (!sk->sk_bound_dev_if &&
1262 ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL)
1263 treq->iif = inet6_iif(skb);
1264
1258 if (!isn) { 1265 if (!isn) {
1259 struct inet_peer *peer = NULL; 1266 struct inet_peer *peer = NULL;
1260 1267
@@ -1264,12 +1271,6 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
1264 atomic_inc(&skb->users); 1271 atomic_inc(&skb->users);
1265 treq->pktopts = skb; 1272 treq->pktopts = skb;
1266 } 1273 }
1267 treq->iif = sk->sk_bound_dev_if;
1268
1269 /* So that link locals have meaning */
1270 if (!sk->sk_bound_dev_if &&
1271 ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL)
1272 treq->iif = inet6_iif(skb);
1273 1274
1274 if (want_cookie) { 1275 if (want_cookie) {
1275 isn = cookie_v6_init_sequence(sk, skb, &req->mss); 1276 isn = cookie_v6_init_sequence(sk, skb, &req->mss);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 846f4757eb8..8c254191518 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -340,7 +340,7 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,
340 struct ipv6_pinfo *np = inet6_sk(sk); 340 struct ipv6_pinfo *np = inet6_sk(sk);
341 struct inet_sock *inet = inet_sk(sk); 341 struct inet_sock *inet = inet_sk(sk);
342 struct sk_buff *skb; 342 struct sk_buff *skb;
343 unsigned int ulen; 343 unsigned int ulen, copied;
344 int peeked; 344 int peeked;
345 int err; 345 int err;
346 int is_udplite = IS_UDPLITE(sk); 346 int is_udplite = IS_UDPLITE(sk);
@@ -363,9 +363,10 @@ try_again:
363 goto out; 363 goto out;
364 364
365 ulen = skb->len - sizeof(struct udphdr); 365 ulen = skb->len - sizeof(struct udphdr);
366 if (len > ulen) 366 copied = len;
367 len = ulen; 367 if (copied > ulen)
368 else if (len < ulen) 368 copied = ulen;
369 else if (copied < ulen)
369 msg->msg_flags |= MSG_TRUNC; 370 msg->msg_flags |= MSG_TRUNC;
370 371
371 is_udp4 = (skb->protocol == htons(ETH_P_IP)); 372 is_udp4 = (skb->protocol == htons(ETH_P_IP));
@@ -376,14 +377,14 @@ try_again:
376 * coverage checksum (UDP-Lite), do it before the copy. 377 * coverage checksum (UDP-Lite), do it before the copy.
377 */ 378 */
378 379
379 if (len < ulen || UDP_SKB_CB(skb)->partial_cov) { 380 if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) {
380 if (udp_lib_checksum_complete(skb)) 381 if (udp_lib_checksum_complete(skb))
381 goto csum_copy_err; 382 goto csum_copy_err;
382 } 383 }
383 384
384 if (skb_csum_unnecessary(skb)) 385 if (skb_csum_unnecessary(skb))
385 err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), 386 err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),
386 msg->msg_iov,len); 387 msg->msg_iov, copied );
387 else { 388 else {
388 err = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov); 389 err = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov);
389 if (err == -EINVAL) 390 if (err == -EINVAL)
@@ -432,7 +433,7 @@ try_again:
432 datagram_recv_ctl(sk, msg, skb); 433 datagram_recv_ctl(sk, msg, skb);
433 } 434 }
434 435
435 err = len; 436 err = copied;
436 if (flags & MSG_TRUNC) 437 if (flags & MSG_TRUNC)
437 err = ulen; 438 err = ulen;
438 439
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index cf0f308abf5..89ff8c67943 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1072,7 +1072,7 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len
1072 1072
1073 /* Get routing info from the tunnel socket */ 1073 /* Get routing info from the tunnel socket */
1074 skb_dst_drop(skb); 1074 skb_dst_drop(skb);
1075 skb_dst_set(skb, dst_clone(__sk_dst_get(sk))); 1075 skb_dst_set(skb, dst_clone(__sk_dst_check(sk, 0)));
1076 1076
1077 inet = inet_sk(sk); 1077 inet = inet_sk(sk);
1078 fl = &inet->cork.fl; 1078 fl = &inet->cork.fl;
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index b3f65520e7a..b064e4df12c 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -161,6 +161,12 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
161 return -ENOENT; 161 return -ENOENT;
162 } 162 }
163 163
164 /* if we're already stopping ignore any new requests to stop */
165 if (test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
166 spin_unlock_bh(&sta->lock);
167 return -EALREADY;
168 }
169
164 if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) { 170 if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) {
165 /* not even started yet! */ 171 /* not even started yet! */
166 ieee80211_assign_tid_tx(sta, tid, NULL); 172 ieee80211_assign_tid_tx(sta, tid, NULL);
@@ -169,6 +175,8 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
169 return 0; 175 return 0;
170 } 176 }
171 177
178 set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state);
179
172 spin_unlock_bh(&sta->lock); 180 spin_unlock_bh(&sta->lock);
173 181
174#ifdef CONFIG_MAC80211_HT_DEBUG 182#ifdef CONFIG_MAC80211_HT_DEBUG
@@ -176,8 +184,6 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
176 sta->sta.addr, tid); 184 sta->sta.addr, tid);
177#endif /* CONFIG_MAC80211_HT_DEBUG */ 185#endif /* CONFIG_MAC80211_HT_DEBUG */
178 186
179 set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state);
180
181 del_timer_sync(&tid_tx->addba_resp_timer); 187 del_timer_sync(&tid_tx->addba_resp_timer);
182 188
183 /* 189 /*
@@ -187,6 +193,20 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
187 */ 193 */
188 clear_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state); 194 clear_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state);
189 195
196 /*
197 * There might be a few packets being processed right now (on
198 * another CPU) that have already gotten past the aggregation
199 * check when it was still OPERATIONAL and consequently have
200 * IEEE80211_TX_CTL_AMPDU set. In that case, this code might
201 * call into the driver at the same time or even before the
202 * TX paths calls into it, which could confuse the driver.
203 *
204 * Wait for all currently running TX paths to finish before
205 * telling the driver. New packets will not go through since
206 * the aggregation session is no longer OPERATIONAL.
207 */
208 synchronize_net();
209
190 tid_tx->stop_initiator = initiator; 210 tid_tx->stop_initiator = initiator;
191 tid_tx->tx_stop = tx; 211 tid_tx->tx_stop = tx;
192 212
@@ -757,11 +777,27 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
757 goto out; 777 goto out;
758 } 778 }
759 779
760 del_timer(&tid_tx->addba_resp_timer); 780 del_timer_sync(&tid_tx->addba_resp_timer);
761 781
762#ifdef CONFIG_MAC80211_HT_DEBUG 782#ifdef CONFIG_MAC80211_HT_DEBUG
763 printk(KERN_DEBUG "switched off addBA timer for tid %d\n", tid); 783 printk(KERN_DEBUG "switched off addBA timer for tid %d\n", tid);
764#endif 784#endif
785
786 /*
787 * addba_resp_timer may have fired before we got here, and
788 * caused WANT_STOP to be set. If the stop then was already
789 * processed further, STOPPING might be set.
790 */
791 if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) ||
792 test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
793#ifdef CONFIG_MAC80211_HT_DEBUG
794 printk(KERN_DEBUG
795 "got addBA resp for tid %d but we already gave up\n",
796 tid);
797#endif
798 goto out;
799 }
800
765 /* 801 /*
766 * IEEE 802.11-2007 7.3.1.14: 802 * IEEE 802.11-2007 7.3.1.14:
767 * In an ADDBA Response frame, when the Status Code field 803 * In an ADDBA Response frame, when the Status Code field
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index c5f341798c1..3110cbdc501 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -274,9 +274,9 @@ static ssize_t sta_ht_capa_read(struct file *file, char __user *userbuf,
274 274
275 PRINT_HT_CAP((htc->cap & BIT(10)), "HT Delayed Block Ack"); 275 PRINT_HT_CAP((htc->cap & BIT(10)), "HT Delayed Block Ack");
276 276
277 PRINT_HT_CAP((htc->cap & BIT(11)), "Max AMSDU length: "
278 "3839 bytes");
279 PRINT_HT_CAP(!(htc->cap & BIT(11)), "Max AMSDU length: " 277 PRINT_HT_CAP(!(htc->cap & BIT(11)), "Max AMSDU length: "
278 "3839 bytes");
279 PRINT_HT_CAP((htc->cap & BIT(11)), "Max AMSDU length: "
280 "7935 bytes"); 280 "7935 bytes");
281 281
282 /* 282 /*
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 80de436eae2..16518f38611 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -260,7 +260,7 @@ static void ieee80211_add_tx_radiotap_header(struct ieee80211_supported_band
260 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 260 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
261 struct ieee80211_radiotap_header *rthdr; 261 struct ieee80211_radiotap_header *rthdr;
262 unsigned char *pos; 262 unsigned char *pos;
263 __le16 txflags; 263 u16 txflags;
264 264
265 rthdr = (struct ieee80211_radiotap_header *) skb_push(skb, rtap_len); 265 rthdr = (struct ieee80211_radiotap_header *) skb_push(skb, rtap_len);
266 266
@@ -290,13 +290,13 @@ static void ieee80211_add_tx_radiotap_header(struct ieee80211_supported_band
290 txflags = 0; 290 txflags = 0;
291 if (!(info->flags & IEEE80211_TX_STAT_ACK) && 291 if (!(info->flags & IEEE80211_TX_STAT_ACK) &&
292 !is_multicast_ether_addr(hdr->addr1)) 292 !is_multicast_ether_addr(hdr->addr1))
293 txflags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_FAIL); 293 txflags |= IEEE80211_RADIOTAP_F_TX_FAIL;
294 294
295 if ((info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || 295 if ((info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) ||
296 (info->status.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) 296 (info->status.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT))
297 txflags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_CTS); 297 txflags |= IEEE80211_RADIOTAP_F_TX_CTS;
298 else if (info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) 298 else if (info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS)
299 txflags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_RTS); 299 txflags |= IEEE80211_RADIOTAP_F_TX_RTS;
300 300
301 put_unaligned_le16(txflags, pos); 301 put_unaligned_le16(txflags, pos);
302 pos += 2; 302 pos += 2;
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index 8260b13d93c..d5597b759ba 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -201,7 +201,6 @@ config NF_CONNTRACK_BROADCAST
201 201
202config NF_CONNTRACK_NETBIOS_NS 202config NF_CONNTRACK_NETBIOS_NS
203 tristate "NetBIOS name service protocol support" 203 tristate "NetBIOS name service protocol support"
204 depends on NETFILTER_ADVANCED
205 select NF_CONNTRACK_BROADCAST 204 select NF_CONNTRACK_BROADCAST
206 help 205 help
207 NetBIOS name service requests are sent as broadcast messages from an 206 NetBIOS name service requests are sent as broadcast messages from an
@@ -542,7 +541,6 @@ config NETFILTER_XT_TARGET_NOTRACK
542 tristate '"NOTRACK" target support' 541 tristate '"NOTRACK" target support'
543 depends on IP_NF_RAW || IP6_NF_RAW 542 depends on IP_NF_RAW || IP6_NF_RAW
544 depends on NF_CONNTRACK 543 depends on NF_CONNTRACK
545 depends on NETFILTER_ADVANCED
546 help 544 help
547 The NOTRACK target allows a select rule to specify 545 The NOTRACK target allows a select rule to specify
548 which packets *not* to enter the conntrack/NAT 546 which packets *not* to enter the conntrack/NAT
diff --git a/net/netfilter/ipset/ip_set_hash_ipport.c b/net/netfilter/ipset/ip_set_hash_ipport.c
index 6ee10f5d59b..37d667e3f6f 100644
--- a/net/netfilter/ipset/ip_set_hash_ipport.c
+++ b/net/netfilter/ipset/ip_set_hash_ipport.c
@@ -158,7 +158,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[],
158 const struct ip_set_hash *h = set->data; 158 const struct ip_set_hash *h = set->data;
159 ipset_adtfn adtfn = set->variant->adt[adt]; 159 ipset_adtfn adtfn = set->variant->adt[adt];
160 struct hash_ipport4_elem data = { }; 160 struct hash_ipport4_elem data = { };
161 u32 ip, ip_to, p = 0, port, port_to; 161 u32 ip, ip_to = 0, p = 0, port, port_to;
162 u32 timeout = h->timeout; 162 u32 timeout = h->timeout;
163 bool with_ports = false; 163 bool with_ports = false;
164 int ret; 164 int ret;
diff --git a/net/netfilter/ipset/ip_set_hash_ipportip.c b/net/netfilter/ipset/ip_set_hash_ipportip.c
index fb90e344e90..e69e2718fbe 100644
--- a/net/netfilter/ipset/ip_set_hash_ipportip.c
+++ b/net/netfilter/ipset/ip_set_hash_ipportip.c
@@ -162,7 +162,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[],
162 const struct ip_set_hash *h = set->data; 162 const struct ip_set_hash *h = set->data;
163 ipset_adtfn adtfn = set->variant->adt[adt]; 163 ipset_adtfn adtfn = set->variant->adt[adt];
164 struct hash_ipportip4_elem data = { }; 164 struct hash_ipportip4_elem data = { };
165 u32 ip, ip_to, p = 0, port, port_to; 165 u32 ip, ip_to = 0, p = 0, port, port_to;
166 u32 timeout = h->timeout; 166 u32 timeout = h->timeout;
167 bool with_ports = false; 167 bool with_ports = false;
168 int ret; 168 int ret;
diff --git a/net/netfilter/ipset/ip_set_hash_ipportnet.c b/net/netfilter/ipset/ip_set_hash_ipportnet.c
index deb3e3dfa5f..64199b4e93c 100644
--- a/net/netfilter/ipset/ip_set_hash_ipportnet.c
+++ b/net/netfilter/ipset/ip_set_hash_ipportnet.c
@@ -184,7 +184,7 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
184 const struct ip_set_hash *h = set->data; 184 const struct ip_set_hash *h = set->data;
185 ipset_adtfn adtfn = set->variant->adt[adt]; 185 ipset_adtfn adtfn = set->variant->adt[adt];
186 struct hash_ipportnet4_elem data = { .cidr = HOST_MASK }; 186 struct hash_ipportnet4_elem data = { .cidr = HOST_MASK };
187 u32 ip, ip_to, p = 0, port, port_to; 187 u32 ip, ip_to = 0, p = 0, port, port_to;
188 u32 ip2_from = 0, ip2_to, ip2_last, ip2; 188 u32 ip2_from = 0, ip2_to, ip2_last, ip2;
189 u32 timeout = h->timeout; 189 u32 timeout = h->timeout;
190 bool with_ports = false; 190 bool with_ports = false;
diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c
index 6b368be937c..b62c4148b92 100644
--- a/net/netfilter/nf_conntrack_ecache.c
+++ b/net/netfilter/nf_conntrack_ecache.c
@@ -27,22 +27,17 @@
27 27
28static DEFINE_MUTEX(nf_ct_ecache_mutex); 28static DEFINE_MUTEX(nf_ct_ecache_mutex);
29 29
30struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb __read_mostly;
31EXPORT_SYMBOL_GPL(nf_conntrack_event_cb);
32
33struct nf_exp_event_notifier __rcu *nf_expect_event_cb __read_mostly;
34EXPORT_SYMBOL_GPL(nf_expect_event_cb);
35
36/* deliver cached events and clear cache entry - must be called with locally 30/* deliver cached events and clear cache entry - must be called with locally
37 * disabled softirqs */ 31 * disabled softirqs */
38void nf_ct_deliver_cached_events(struct nf_conn *ct) 32void nf_ct_deliver_cached_events(struct nf_conn *ct)
39{ 33{
34 struct net *net = nf_ct_net(ct);
40 unsigned long events; 35 unsigned long events;
41 struct nf_ct_event_notifier *notify; 36 struct nf_ct_event_notifier *notify;
42 struct nf_conntrack_ecache *e; 37 struct nf_conntrack_ecache *e;
43 38
44 rcu_read_lock(); 39 rcu_read_lock();
45 notify = rcu_dereference(nf_conntrack_event_cb); 40 notify = rcu_dereference(net->ct.nf_conntrack_event_cb);
46 if (notify == NULL) 41 if (notify == NULL)
47 goto out_unlock; 42 goto out_unlock;
48 43
@@ -83,19 +78,20 @@ out_unlock:
83} 78}
84EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events); 79EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events);
85 80
86int nf_conntrack_register_notifier(struct nf_ct_event_notifier *new) 81int nf_conntrack_register_notifier(struct net *net,
82 struct nf_ct_event_notifier *new)
87{ 83{
88 int ret = 0; 84 int ret = 0;
89 struct nf_ct_event_notifier *notify; 85 struct nf_ct_event_notifier *notify;
90 86
91 mutex_lock(&nf_ct_ecache_mutex); 87 mutex_lock(&nf_ct_ecache_mutex);
92 notify = rcu_dereference_protected(nf_conntrack_event_cb, 88 notify = rcu_dereference_protected(net->ct.nf_conntrack_event_cb,
93 lockdep_is_held(&nf_ct_ecache_mutex)); 89 lockdep_is_held(&nf_ct_ecache_mutex));
94 if (notify != NULL) { 90 if (notify != NULL) {
95 ret = -EBUSY; 91 ret = -EBUSY;
96 goto out_unlock; 92 goto out_unlock;
97 } 93 }
98 RCU_INIT_POINTER(nf_conntrack_event_cb, new); 94 RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, new);
99 mutex_unlock(&nf_ct_ecache_mutex); 95 mutex_unlock(&nf_ct_ecache_mutex);
100 return ret; 96 return ret;
101 97
@@ -105,32 +101,34 @@ out_unlock:
105} 101}
106EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier); 102EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier);
107 103
108void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *new) 104void nf_conntrack_unregister_notifier(struct net *net,
105 struct nf_ct_event_notifier *new)
109{ 106{
110 struct nf_ct_event_notifier *notify; 107 struct nf_ct_event_notifier *notify;
111 108
112 mutex_lock(&nf_ct_ecache_mutex); 109 mutex_lock(&nf_ct_ecache_mutex);
113 notify = rcu_dereference_protected(nf_conntrack_event_cb, 110 notify = rcu_dereference_protected(net->ct.nf_conntrack_event_cb,
114 lockdep_is_held(&nf_ct_ecache_mutex)); 111 lockdep_is_held(&nf_ct_ecache_mutex));
115 BUG_ON(notify != new); 112 BUG_ON(notify != new);
116 RCU_INIT_POINTER(nf_conntrack_event_cb, NULL); 113 RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, NULL);
117 mutex_unlock(&nf_ct_ecache_mutex); 114 mutex_unlock(&nf_ct_ecache_mutex);
118} 115}
119EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier); 116EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier);
120 117
121int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *new) 118int nf_ct_expect_register_notifier(struct net *net,
119 struct nf_exp_event_notifier *new)
122{ 120{
123 int ret = 0; 121 int ret = 0;
124 struct nf_exp_event_notifier *notify; 122 struct nf_exp_event_notifier *notify;
125 123
126 mutex_lock(&nf_ct_ecache_mutex); 124 mutex_lock(&nf_ct_ecache_mutex);
127 notify = rcu_dereference_protected(nf_expect_event_cb, 125 notify = rcu_dereference_protected(net->ct.nf_expect_event_cb,
128 lockdep_is_held(&nf_ct_ecache_mutex)); 126 lockdep_is_held(&nf_ct_ecache_mutex));
129 if (notify != NULL) { 127 if (notify != NULL) {
130 ret = -EBUSY; 128 ret = -EBUSY;
131 goto out_unlock; 129 goto out_unlock;
132 } 130 }
133 RCU_INIT_POINTER(nf_expect_event_cb, new); 131 RCU_INIT_POINTER(net->ct.nf_expect_event_cb, new);
134 mutex_unlock(&nf_ct_ecache_mutex); 132 mutex_unlock(&nf_ct_ecache_mutex);
135 return ret; 133 return ret;
136 134
@@ -140,15 +138,16 @@ out_unlock:
140} 138}
141EXPORT_SYMBOL_GPL(nf_ct_expect_register_notifier); 139EXPORT_SYMBOL_GPL(nf_ct_expect_register_notifier);
142 140
143void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *new) 141void nf_ct_expect_unregister_notifier(struct net *net,
142 struct nf_exp_event_notifier *new)
144{ 143{
145 struct nf_exp_event_notifier *notify; 144 struct nf_exp_event_notifier *notify;
146 145
147 mutex_lock(&nf_ct_ecache_mutex); 146 mutex_lock(&nf_ct_ecache_mutex);
148 notify = rcu_dereference_protected(nf_expect_event_cb, 147 notify = rcu_dereference_protected(net->ct.nf_expect_event_cb,
149 lockdep_is_held(&nf_ct_ecache_mutex)); 148 lockdep_is_held(&nf_ct_ecache_mutex));
150 BUG_ON(notify != new); 149 BUG_ON(notify != new);
151 RCU_INIT_POINTER(nf_expect_event_cb, NULL); 150 RCU_INIT_POINTER(net->ct.nf_expect_event_cb, NULL);
152 mutex_unlock(&nf_ct_ecache_mutex); 151 mutex_unlock(&nf_ct_ecache_mutex);
153} 152}
154EXPORT_SYMBOL_GPL(nf_ct_expect_unregister_notifier); 153EXPORT_SYMBOL_GPL(nf_ct_expect_unregister_notifier);
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index e58aa9b1fe8..ef21b221f03 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -4,7 +4,7 @@
4 * (C) 2001 by Jay Schulist <jschlst@samba.org> 4 * (C) 2001 by Jay Schulist <jschlst@samba.org>
5 * (C) 2002-2006 by Harald Welte <laforge@gnumonks.org> 5 * (C) 2002-2006 by Harald Welte <laforge@gnumonks.org>
6 * (C) 2003 by Patrick Mchardy <kaber@trash.net> 6 * (C) 2003 by Patrick Mchardy <kaber@trash.net>
7 * (C) 2005-2008 by Pablo Neira Ayuso <pablo@netfilter.org> 7 * (C) 2005-2011 by Pablo Neira Ayuso <pablo@netfilter.org>
8 * 8 *
9 * Initial connection tracking via netlink development funded and 9 * Initial connection tracking via netlink development funded and
10 * generally made possible by Network Robots, Inc. (www.networkrobots.com) 10 * generally made possible by Network Robots, Inc. (www.networkrobots.com)
@@ -2163,6 +2163,54 @@ MODULE_ALIAS("ip_conntrack_netlink");
2163MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK); 2163MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK);
2164MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK_EXP); 2164MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK_EXP);
2165 2165
2166static int __net_init ctnetlink_net_init(struct net *net)
2167{
2168#ifdef CONFIG_NF_CONNTRACK_EVENTS
2169 int ret;
2170
2171 ret = nf_conntrack_register_notifier(net, &ctnl_notifier);
2172 if (ret < 0) {
2173 pr_err("ctnetlink_init: cannot register notifier.\n");
2174 goto err_out;
2175 }
2176
2177 ret = nf_ct_expect_register_notifier(net, &ctnl_notifier_exp);
2178 if (ret < 0) {
2179 pr_err("ctnetlink_init: cannot expect register notifier.\n");
2180 goto err_unreg_notifier;
2181 }
2182#endif
2183 return 0;
2184
2185#ifdef CONFIG_NF_CONNTRACK_EVENTS
2186err_unreg_notifier:
2187 nf_conntrack_unregister_notifier(net, &ctnl_notifier);
2188err_out:
2189 return ret;
2190#endif
2191}
2192
2193static void ctnetlink_net_exit(struct net *net)
2194{
2195#ifdef CONFIG_NF_CONNTRACK_EVENTS
2196 nf_ct_expect_unregister_notifier(net, &ctnl_notifier_exp);
2197 nf_conntrack_unregister_notifier(net, &ctnl_notifier);
2198#endif
2199}
2200
2201static void __net_exit ctnetlink_net_exit_batch(struct list_head *net_exit_list)
2202{
2203 struct net *net;
2204
2205 list_for_each_entry(net, net_exit_list, exit_list)
2206 ctnetlink_net_exit(net);
2207}
2208
2209static struct pernet_operations ctnetlink_net_ops = {
2210 .init = ctnetlink_net_init,
2211 .exit_batch = ctnetlink_net_exit_batch,
2212};
2213
2166static int __init ctnetlink_init(void) 2214static int __init ctnetlink_init(void)
2167{ 2215{
2168 int ret; 2216 int ret;
@@ -2180,28 +2228,15 @@ static int __init ctnetlink_init(void)
2180 goto err_unreg_subsys; 2228 goto err_unreg_subsys;
2181 } 2229 }
2182 2230
2183#ifdef CONFIG_NF_CONNTRACK_EVENTS 2231 if (register_pernet_subsys(&ctnetlink_net_ops)) {
2184 ret = nf_conntrack_register_notifier(&ctnl_notifier); 2232 pr_err("ctnetlink_init: cannot register pernet operations\n");
2185 if (ret < 0) {
2186 pr_err("ctnetlink_init: cannot register notifier.\n");
2187 goto err_unreg_exp_subsys; 2233 goto err_unreg_exp_subsys;
2188 } 2234 }
2189 2235
2190 ret = nf_ct_expect_register_notifier(&ctnl_notifier_exp);
2191 if (ret < 0) {
2192 pr_err("ctnetlink_init: cannot expect register notifier.\n");
2193 goto err_unreg_notifier;
2194 }
2195#endif
2196
2197 return 0; 2236 return 0;
2198 2237
2199#ifdef CONFIG_NF_CONNTRACK_EVENTS
2200err_unreg_notifier:
2201 nf_conntrack_unregister_notifier(&ctnl_notifier);
2202err_unreg_exp_subsys: 2238err_unreg_exp_subsys:
2203 nfnetlink_subsys_unregister(&ctnl_exp_subsys); 2239 nfnetlink_subsys_unregister(&ctnl_exp_subsys);
2204#endif
2205err_unreg_subsys: 2240err_unreg_subsys:
2206 nfnetlink_subsys_unregister(&ctnl_subsys); 2241 nfnetlink_subsys_unregister(&ctnl_subsys);
2207err_out: 2242err_out:
@@ -2213,11 +2248,7 @@ static void __exit ctnetlink_exit(void)
2213 pr_info("ctnetlink: unregistering from nfnetlink.\n"); 2248 pr_info("ctnetlink: unregistering from nfnetlink.\n");
2214 2249
2215 nf_ct_remove_userspace_expectations(); 2250 nf_ct_remove_userspace_expectations();
2216#ifdef CONFIG_NF_CONNTRACK_EVENTS 2251 unregister_pernet_subsys(&ctnetlink_net_ops);
2217 nf_ct_expect_unregister_notifier(&ctnl_notifier_exp);
2218 nf_conntrack_unregister_notifier(&ctnl_notifier);
2219#endif
2220
2221 nfnetlink_subsys_unregister(&ctnl_exp_subsys); 2252 nfnetlink_subsys_unregister(&ctnl_exp_subsys);
2222 nfnetlink_subsys_unregister(&ctnl_subsys); 2253 nfnetlink_subsys_unregister(&ctnl_subsys);
2223} 2254}
diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
index 9c24de10a65..824f184f7a9 100644
--- a/net/netlabel/netlabel_kapi.c
+++ b/net/netlabel/netlabel_kapi.c
@@ -111,8 +111,6 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
111 struct netlbl_domaddr_map *addrmap = NULL; 111 struct netlbl_domaddr_map *addrmap = NULL;
112 struct netlbl_domaddr4_map *map4 = NULL; 112 struct netlbl_domaddr4_map *map4 = NULL;
113 struct netlbl_domaddr6_map *map6 = NULL; 113 struct netlbl_domaddr6_map *map6 = NULL;
114 const struct in_addr *addr4, *mask4;
115 const struct in6_addr *addr6, *mask6;
116 114
117 entry = kzalloc(sizeof(*entry), GFP_ATOMIC); 115 entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
118 if (entry == NULL) 116 if (entry == NULL)
@@ -133,9 +131,9 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
133 INIT_LIST_HEAD(&addrmap->list6); 131 INIT_LIST_HEAD(&addrmap->list6);
134 132
135 switch (family) { 133 switch (family) {
136 case AF_INET: 134 case AF_INET: {
137 addr4 = addr; 135 const struct in_addr *addr4 = addr;
138 mask4 = mask; 136 const struct in_addr *mask4 = mask;
139 map4 = kzalloc(sizeof(*map4), GFP_ATOMIC); 137 map4 = kzalloc(sizeof(*map4), GFP_ATOMIC);
140 if (map4 == NULL) 138 if (map4 == NULL)
141 goto cfg_unlbl_map_add_failure; 139 goto cfg_unlbl_map_add_failure;
@@ -148,9 +146,11 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
148 if (ret_val != 0) 146 if (ret_val != 0)
149 goto cfg_unlbl_map_add_failure; 147 goto cfg_unlbl_map_add_failure;
150 break; 148 break;
151 case AF_INET6: 149 }
152 addr6 = addr; 150#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
153 mask6 = mask; 151 case AF_INET6: {
152 const struct in6_addr *addr6 = addr;
153 const struct in6_addr *mask6 = mask;
154 map6 = kzalloc(sizeof(*map6), GFP_ATOMIC); 154 map6 = kzalloc(sizeof(*map6), GFP_ATOMIC);
155 if (map6 == NULL) 155 if (map6 == NULL)
156 goto cfg_unlbl_map_add_failure; 156 goto cfg_unlbl_map_add_failure;
@@ -162,11 +162,13 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
162 map6->list.addr.s6_addr32[3] &= mask6->s6_addr32[3]; 162 map6->list.addr.s6_addr32[3] &= mask6->s6_addr32[3];
163 ipv6_addr_copy(&map6->list.mask, mask6); 163 ipv6_addr_copy(&map6->list.mask, mask6);
164 map6->list.valid = 1; 164 map6->list.valid = 1;
165 ret_val = netlbl_af4list_add(&map4->list, 165 ret_val = netlbl_af6list_add(&map6->list,
166 &addrmap->list4); 166 &addrmap->list6);
167 if (ret_val != 0) 167 if (ret_val != 0)
168 goto cfg_unlbl_map_add_failure; 168 goto cfg_unlbl_map_add_failure;
169 break; 169 break;
170 }
171#endif /* IPv6 */
170 default: 172 default:
171 goto cfg_unlbl_map_add_failure; 173 goto cfg_unlbl_map_add_failure;
172 break; 174 break;
@@ -225,9 +227,11 @@ int netlbl_cfg_unlbl_static_add(struct net *net,
225 case AF_INET: 227 case AF_INET:
226 addr_len = sizeof(struct in_addr); 228 addr_len = sizeof(struct in_addr);
227 break; 229 break;
230#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
228 case AF_INET6: 231 case AF_INET6:
229 addr_len = sizeof(struct in6_addr); 232 addr_len = sizeof(struct in6_addr);
230 break; 233 break;
234#endif /* IPv6 */
231 default: 235 default:
232 return -EPFNOSUPPORT; 236 return -EPFNOSUPPORT;
233 } 237 }
@@ -266,9 +270,11 @@ int netlbl_cfg_unlbl_static_del(struct net *net,
266 case AF_INET: 270 case AF_INET:
267 addr_len = sizeof(struct in_addr); 271 addr_len = sizeof(struct in_addr);
268 break; 272 break;
273#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
269 case AF_INET6: 274 case AF_INET6:
270 addr_len = sizeof(struct in6_addr); 275 addr_len = sizeof(struct in6_addr);
271 break; 276 break;
277#endif /* IPv6 */
272 default: 278 default:
273 return -EPFNOSUPPORT; 279 return -EPFNOSUPPORT;
274 } 280 }
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index 6649463da1b..d617161f8dd 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -209,8 +209,8 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt)
209 ctl->Plog, ctl->Scell_log, 209 ctl->Plog, ctl->Scell_log,
210 nla_data(tb[TCA_RED_STAB])); 210 nla_data(tb[TCA_RED_STAB]));
211 211
212 if (skb_queue_empty(&sch->q)) 212 if (!q->qdisc->q.qlen)
213 red_end_of_idle_period(&q->parms); 213 red_start_of_idle_period(&q->parms);
214 214
215 sch_tree_unlock(sch); 215 sch_tree_unlock(sch);
216 return 0; 216 return 0;
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index a3b7120fcc7..4f4c52c0eeb 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -225,11 +225,11 @@ static int teql_qdisc_init(struct Qdisc *sch, struct nlattr *opt)
225 225
226 226
227static int 227static int
228__teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *dev) 228__teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res,
229 struct net_device *dev, struct netdev_queue *txq,
230 struct neighbour *mn)
229{ 231{
230 struct netdev_queue *dev_queue = netdev_get_tx_queue(dev, 0); 232 struct teql_sched_data *q = qdisc_priv(txq->qdisc);
231 struct teql_sched_data *q = qdisc_priv(dev_queue->qdisc);
232 struct neighbour *mn = dst_get_neighbour(skb_dst(skb));
233 struct neighbour *n = q->ncache; 233 struct neighbour *n = q->ncache;
234 234
235 if (mn->tbl == NULL) 235 if (mn->tbl == NULL)
@@ -262,17 +262,26 @@ __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *
262} 262}
263 263
264static inline int teql_resolve(struct sk_buff *skb, 264static inline int teql_resolve(struct sk_buff *skb,
265 struct sk_buff *skb_res, struct net_device *dev) 265 struct sk_buff *skb_res,
266 struct net_device *dev,
267 struct netdev_queue *txq)
266{ 268{
267 struct netdev_queue *txq = netdev_get_tx_queue(dev, 0); 269 struct dst_entry *dst = skb_dst(skb);
270 struct neighbour *mn;
271 int res;
272
268 if (txq->qdisc == &noop_qdisc) 273 if (txq->qdisc == &noop_qdisc)
269 return -ENODEV; 274 return -ENODEV;
270 275
271 if (dev->header_ops == NULL || 276 if (!dev->header_ops || !dst)
272 skb_dst(skb) == NULL ||
273 dst_get_neighbour(skb_dst(skb)) == NULL)
274 return 0; 277 return 0;
275 return __teql_resolve(skb, skb_res, dev); 278
279 rcu_read_lock();
280 mn = dst_get_neighbour(dst);
281 res = mn ? __teql_resolve(skb, skb_res, dev, txq, mn) : 0;
282 rcu_read_unlock();
283
284 return res;
276} 285}
277 286
278static netdev_tx_t teql_master_xmit(struct sk_buff *skb, struct net_device *dev) 287static netdev_tx_t teql_master_xmit(struct sk_buff *skb, struct net_device *dev)
@@ -307,7 +316,7 @@ restart:
307 continue; 316 continue;
308 } 317 }
309 318
310 switch (teql_resolve(skb, skb_res, slave)) { 319 switch (teql_resolve(skb, skb_res, slave, slave_txq)) {
311 case 0: 320 case 0:
312 if (__netif_tx_trylock(slave_txq)) { 321 if (__netif_tx_trylock(slave_txq)) {
313 unsigned int length = qdisc_pkt_len(skb); 322 unsigned int length = qdisc_pkt_len(skb);
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index 865e68fef21..bf812048cf6 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -82,7 +82,7 @@ static struct sctp_auth_bytes *sctp_auth_create_key(__u32 key_len, gfp_t gfp)
82 struct sctp_auth_bytes *key; 82 struct sctp_auth_bytes *key;
83 83
84 /* Verify that we are not going to overflow INT_MAX */ 84 /* Verify that we are not going to overflow INT_MAX */
85 if ((INT_MAX - key_len) < sizeof(struct sctp_auth_bytes)) 85 if (key_len > (INT_MAX - sizeof(struct sctp_auth_bytes)))
86 return NULL; 86 return NULL;
87 87
88 /* Allocate the shared key */ 88 /* Allocate the shared key */
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 466fbcc5cf7..b595a3d8679 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1957,6 +1957,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
1957 if ((UNIXCB(skb).pid != siocb->scm->pid) || 1957 if ((UNIXCB(skb).pid != siocb->scm->pid) ||
1958 (UNIXCB(skb).cred != siocb->scm->cred)) { 1958 (UNIXCB(skb).cred != siocb->scm->cred)) {
1959 skb_queue_head(&sk->sk_receive_queue, skb); 1959 skb_queue_head(&sk->sk_receive_queue, skb);
1960 sk->sk_data_ready(sk, skb->len);
1960 break; 1961 break;
1961 } 1962 }
1962 } else { 1963 } else {
@@ -1974,6 +1975,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
1974 chunk = min_t(unsigned int, skb->len, size); 1975 chunk = min_t(unsigned int, skb->len, size);
1975 if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) { 1976 if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) {
1976 skb_queue_head(&sk->sk_receive_queue, skb); 1977 skb_queue_head(&sk->sk_receive_queue, skb);
1978 sk->sk_data_ready(sk, skb->len);
1977 if (copied == 0) 1979 if (copied == 0)
1978 copied = -EFAULT; 1980 copied = -EFAULT;
1979 break; 1981 break;
@@ -1991,6 +1993,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
1991 /* put the skb back if we didn't use it up.. */ 1993 /* put the skb back if we didn't use it up.. */
1992 if (skb->len) { 1994 if (skb->len) {
1993 skb_queue_head(&sk->sk_receive_queue, skb); 1995 skb_queue_head(&sk->sk_receive_queue, skb);
1996 sk->sk_data_ready(sk, skb->len);
1994 break; 1997 break;
1995 } 1998 }
1996 1999
@@ -2006,6 +2009,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
2006 2009
2007 /* put message back and return */ 2010 /* put message back and return */
2008 skb_queue_head(&sk->sk_receive_queue, skb); 2011 skb_queue_head(&sk->sk_receive_queue, skb);
2012 sk->sk_data_ready(sk, skb->len);
2009 break; 2013 break;
2010 } 2014 }
2011 } while (size); 2015 } while (size);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index b3a476fe827..ffafda5022c 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -89,8 +89,8 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
89 [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, 89 [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 },
90 [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 }, 90 [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 },
91 91
92 [NL80211_ATTR_MAC] = { .type = NLA_BINARY, .len = ETH_ALEN }, 92 [NL80211_ATTR_MAC] = { .len = ETH_ALEN },
93 [NL80211_ATTR_PREV_BSSID] = { .type = NLA_BINARY, .len = ETH_ALEN }, 93 [NL80211_ATTR_PREV_BSSID] = { .len = ETH_ALEN },
94 94
95 [NL80211_ATTR_KEY] = { .type = NLA_NESTED, }, 95 [NL80211_ATTR_KEY] = { .type = NLA_NESTED, },
96 [NL80211_ATTR_KEY_DATA] = { .type = NLA_BINARY, 96 [NL80211_ATTR_KEY_DATA] = { .type = NLA_BINARY,
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index e71f5a66574..77e92673801 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2037,6 +2037,10 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
2037 } 2037 }
2038 2038
2039 request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); 2039 request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx);
2040 if (!request_wiphy) {
2041 reg_set_request_processed();
2042 return -ENODEV;
2043 }
2040 2044
2041 if (!last_request->intersect) { 2045 if (!last_request->intersect) {
2042 int r; 2046 int r;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 552df27dcf5..2118d644663 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2382,9 +2382,11 @@ static unsigned int xfrm_default_advmss(const struct dst_entry *dst)
2382 return dst_metric_advmss(dst->path); 2382 return dst_metric_advmss(dst->path);
2383} 2383}
2384 2384
2385static unsigned int xfrm_default_mtu(const struct dst_entry *dst) 2385static unsigned int xfrm_mtu(const struct dst_entry *dst)
2386{ 2386{
2387 return dst_mtu(dst->path); 2387 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
2388
2389 return mtu ? : dst_mtu(dst->path);
2388} 2390}
2389 2391
2390static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, const void *daddr) 2392static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, const void *daddr)
@@ -2411,8 +2413,8 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
2411 dst_ops->check = xfrm_dst_check; 2413 dst_ops->check = xfrm_dst_check;
2412 if (likely(dst_ops->default_advmss == NULL)) 2414 if (likely(dst_ops->default_advmss == NULL))
2413 dst_ops->default_advmss = xfrm_default_advmss; 2415 dst_ops->default_advmss = xfrm_default_advmss;
2414 if (likely(dst_ops->default_mtu == NULL)) 2416 if (likely(dst_ops->mtu == NULL))
2415 dst_ops->default_mtu = xfrm_default_mtu; 2417 dst_ops->mtu = xfrm_mtu;
2416 if (likely(dst_ops->negative_advice == NULL)) 2418 if (likely(dst_ops->negative_advice == NULL))
2417 dst_ops->negative_advice = xfrm_negative_advice; 2419 dst_ops->negative_advice = xfrm_negative_advice;
2418 if (likely(dst_ops->link_failure == NULL)) 2420 if (likely(dst_ops->link_failure == NULL))