aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/8021q/vlan_dev.c3
-rw-r--r--net/bridge/br.c4
-rw-r--r--net/bridge/br_input.c7
-rw-r--r--net/bridge/netfilter/ebtable_broute.c4
-rw-r--r--net/decnet/dn_dev.c4
-rw-r--r--net/ieee80211/ieee80211_tx.c3
-rw-r--r--net/ipv4/inet_diag.c69
-rw-r--r--net/ipv4/tcp_illinois.c2
-rw-r--r--net/ipv6/addrconf.c11
-rw-r--r--net/mac80211/ieee80211.c10
-rw-r--r--net/mac80211/rx.c2
-rw-r--r--net/mac80211/wep.c3
-rw-r--r--net/netfilter/xt_CONNMARK.c10
-rw-r--r--net/netfilter/xt_CONNSECMARK.c10
-rw-r--r--net/netfilter/xt_TCPMSS.c4
-rw-r--r--net/rfkill/rfkill.c14
-rw-r--r--net/rxrpc/Kconfig1
-rw-r--r--net/sctp/Kconfig6
-rw-r--r--net/sctp/auth.c4
-rw-r--r--net/sctp/sm_make_chunk.c25
-rw-r--r--net/sctp/sm_statefuns.c2
-rw-r--r--net/unix/af_unix.c9
-rw-r--r--net/xfrm/xfrm_policy.c1
23 files changed, 124 insertions, 84 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 7a36878241da..4f99bb86af5c 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -462,7 +462,8 @@ int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
462 * OTHER THINGS LIKE FDDI/TokenRing/802.3 SNAPs... 462 * OTHER THINGS LIKE FDDI/TokenRing/802.3 SNAPs...
463 */ 463 */
464 464
465 if (veth->h_vlan_proto != htons(ETH_P_8021Q)) { 465 if (veth->h_vlan_proto != htons(ETH_P_8021Q) ||
466 VLAN_DEV_INFO(dev)->flags & VLAN_FLAG_REORDER_HDR) {
466 int orig_headroom = skb_headroom(skb); 467 int orig_headroom = skb_headroom(skb);
467 unsigned short veth_TCI; 468 unsigned short veth_TCI;
468 469
diff --git a/net/bridge/br.c b/net/bridge/br.c
index 93867bb6cc97..a90182873120 100644
--- a/net/bridge/br.c
+++ b/net/bridge/br.c
@@ -39,7 +39,7 @@ static int __init br_init(void)
39 39
40 err = br_fdb_init(); 40 err = br_fdb_init();
41 if (err) 41 if (err)
42 goto err_out1; 42 goto err_out;
43 43
44 err = br_netfilter_init(); 44 err = br_netfilter_init();
45 if (err) 45 if (err)
@@ -65,6 +65,8 @@ err_out3:
65err_out2: 65err_out2:
66 br_netfilter_fini(); 66 br_netfilter_fini();
67err_out1: 67err_out1:
68 br_fdb_fini();
69err_out:
68 llc_sap_put(br_stp_sap); 70 llc_sap_put(br_stp_sap);
69 return err; 71 return err;
70} 72}
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 3cedd4eeeed6..0ee79a726d91 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -122,6 +122,7 @@ static inline int is_link_local(const unsigned char *dest)
122struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb) 122struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb)
123{ 123{
124 const unsigned char *dest = eth_hdr(skb)->h_dest; 124 const unsigned char *dest = eth_hdr(skb)->h_dest;
125 int (*rhook)(struct sk_buff *skb);
125 126
126 if (!is_valid_ether_addr(eth_hdr(skb)->h_source)) 127 if (!is_valid_ether_addr(eth_hdr(skb)->h_source))
127 goto drop; 128 goto drop;
@@ -147,9 +148,9 @@ struct sk_buff *br_handle_frame(struct net_bridge_port *p, struct sk_buff *skb)
147 148
148 switch (p->state) { 149 switch (p->state) {
149 case BR_STATE_FORWARDING: 150 case BR_STATE_FORWARDING:
150 151 rhook = rcu_dereference(br_should_route_hook);
151 if (br_should_route_hook) { 152 if (rhook != NULL) {
152 if (br_should_route_hook(skb)) 153 if (rhook(skb))
153 return skb; 154 return skb;
154 dest = eth_hdr(skb)->h_dest; 155 dest = eth_hdr(skb)->h_dest;
155 } 156 }
diff --git a/net/bridge/netfilter/ebtable_broute.c b/net/bridge/netfilter/ebtable_broute.c
index e44519ebf1d2..be6f18681053 100644
--- a/net/bridge/netfilter/ebtable_broute.c
+++ b/net/bridge/netfilter/ebtable_broute.c
@@ -70,13 +70,13 @@ static int __init ebtable_broute_init(void)
70 if (ret < 0) 70 if (ret < 0)
71 return ret; 71 return ret;
72 /* see br_input.c */ 72 /* see br_input.c */
73 br_should_route_hook = ebt_broute; 73 rcu_assign_pointer(br_should_route_hook, ebt_broute);
74 return ret; 74 return ret;
75} 75}
76 76
77static void __exit ebtable_broute_fini(void) 77static void __exit ebtable_broute_fini(void)
78{ 78{
79 br_should_route_hook = NULL; 79 rcu_assign_pointer(br_should_route_hook, NULL);
80 synchronize_net(); 80 synchronize_net();
81 ebt_unregister_table(&broute_table); 81 ebt_unregister_table(&broute_table);
82} 82}
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 66e266fb5908..3bc82dc83b38 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -651,16 +651,18 @@ static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
651 struct dn_dev *dn_db; 651 struct dn_dev *dn_db;
652 struct ifaddrmsg *ifm; 652 struct ifaddrmsg *ifm;
653 struct dn_ifaddr *ifa, **ifap; 653 struct dn_ifaddr *ifa, **ifap;
654 int err = -EADDRNOTAVAIL; 654 int err;
655 655
656 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy); 656 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
657 if (err < 0) 657 if (err < 0)
658 goto errout; 658 goto errout;
659 659
660 err = -ENODEV;
660 ifm = nlmsg_data(nlh); 661 ifm = nlmsg_data(nlh);
661 if ((dn_db = dn_dev_by_index(ifm->ifa_index)) == NULL) 662 if ((dn_db = dn_dev_by_index(ifm->ifa_index)) == NULL)
662 goto errout; 663 goto errout;
663 664
665 err = -EADDRNOTAVAIL;
664 for (ifap = &dn_db->ifa_list; (ifa = *ifap); ifap = &ifa->ifa_next) { 666 for (ifap = &dn_db->ifa_list; (ifa = *ifap); ifap = &ifa->ifa_next) {
665 if (tb[IFA_LOCAL] && 667 if (tb[IFA_LOCAL] &&
666 nla_memcmp(tb[IFA_LOCAL], &ifa->ifa_local, 2)) 668 nla_memcmp(tb[IFA_LOCAL], &ifa->ifa_local, 2))
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c
index a4c3c51140a3..6d06f1385e28 100644
--- a/net/ieee80211/ieee80211_tx.c
+++ b/net/ieee80211/ieee80211_tx.c
@@ -144,7 +144,8 @@ static int ieee80211_copy_snap(u8 * data, u16 h_proto)
144 snap->oui[1] = oui[1]; 144 snap->oui[1] = oui[1];
145 snap->oui[2] = oui[2]; 145 snap->oui[2] = oui[2];
146 146
147 *(u16 *) (data + SNAP_SIZE) = htons(h_proto); 147 h_proto = htons(h_proto);
148 memcpy(data + SNAP_SIZE, &h_proto, sizeof(u16));
148 149
149 return SNAP_SIZE + sizeof(u16); 150 return SNAP_SIZE + sizeof(u16);
150} 151}
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index b0170732b5e9..e468e7a7aac4 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -51,6 +51,29 @@ static struct sock *idiagnl;
51#define INET_DIAG_PUT(skb, attrtype, attrlen) \ 51#define INET_DIAG_PUT(skb, attrtype, attrlen) \
52 RTA_DATA(__RTA_PUT(skb, attrtype, attrlen)) 52 RTA_DATA(__RTA_PUT(skb, attrtype, attrlen))
53 53
54static DEFINE_MUTEX(inet_diag_table_mutex);
55
56static const struct inet_diag_handler *inet_diag_lock_handler(int type)
57{
58#ifdef CONFIG_KMOD
59 if (!inet_diag_table[type])
60 request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
61 NETLINK_INET_DIAG, type);
62#endif
63
64 mutex_lock(&inet_diag_table_mutex);
65 if (!inet_diag_table[type])
66 return ERR_PTR(-ENOENT);
67
68 return inet_diag_table[type];
69}
70
71static inline void inet_diag_unlock_handler(
72 const struct inet_diag_handler *handler)
73{
74 mutex_unlock(&inet_diag_table_mutex);
75}
76
54static int inet_csk_diag_fill(struct sock *sk, 77static int inet_csk_diag_fill(struct sock *sk,
55 struct sk_buff *skb, 78 struct sk_buff *skb,
56 int ext, u32 pid, u32 seq, u16 nlmsg_flags, 79 int ext, u32 pid, u32 seq, u16 nlmsg_flags,
@@ -235,9 +258,12 @@ static int inet_diag_get_exact(struct sk_buff *in_skb,
235 struct inet_hashinfo *hashinfo; 258 struct inet_hashinfo *hashinfo;
236 const struct inet_diag_handler *handler; 259 const struct inet_diag_handler *handler;
237 260
238 handler = inet_diag_table[nlh->nlmsg_type]; 261 handler = inet_diag_lock_handler(nlh->nlmsg_type);
239 BUG_ON(handler == NULL); 262 if (!handler)
263 return -ENOENT;
264
240 hashinfo = handler->idiag_hashinfo; 265 hashinfo = handler->idiag_hashinfo;
266 err = -EINVAL;
241 267
242 if (req->idiag_family == AF_INET) { 268 if (req->idiag_family == AF_INET) {
243 sk = inet_lookup(hashinfo, req->id.idiag_dst[0], 269 sk = inet_lookup(hashinfo, req->id.idiag_dst[0],
@@ -255,11 +281,12 @@ static int inet_diag_get_exact(struct sk_buff *in_skb,
255 } 281 }
256#endif 282#endif
257 else { 283 else {
258 return -EINVAL; 284 goto unlock;
259 } 285 }
260 286
287 err = -ENOENT;
261 if (sk == NULL) 288 if (sk == NULL)
262 return -ENOENT; 289 goto unlock;
263 290
264 err = -ESTALE; 291 err = -ESTALE;
265 if ((req->id.idiag_cookie[0] != INET_DIAG_NOCOOKIE || 292 if ((req->id.idiag_cookie[0] != INET_DIAG_NOCOOKIE ||
@@ -296,6 +323,8 @@ out:
296 else 323 else
297 sock_put(sk); 324 sock_put(sk);
298 } 325 }
326unlock:
327 inet_diag_unlock_handler(handler);
299 return err; 328 return err;
300} 329}
301 330
@@ -678,8 +707,10 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
678 const struct inet_diag_handler *handler; 707 const struct inet_diag_handler *handler;
679 struct inet_hashinfo *hashinfo; 708 struct inet_hashinfo *hashinfo;
680 709
681 handler = inet_diag_table[cb->nlh->nlmsg_type]; 710 handler = inet_diag_lock_handler(cb->nlh->nlmsg_type);
682 BUG_ON(handler == NULL); 711 if (!handler)
712 goto no_handler;
713
683 hashinfo = handler->idiag_hashinfo; 714 hashinfo = handler->idiag_hashinfo;
684 715
685 s_i = cb->args[1]; 716 s_i = cb->args[1];
@@ -743,7 +774,7 @@ skip_listen_ht:
743 } 774 }
744 775
745 if (!(r->idiag_states & ~(TCPF_LISTEN | TCPF_SYN_RECV))) 776 if (!(r->idiag_states & ~(TCPF_LISTEN | TCPF_SYN_RECV)))
746 return skb->len; 777 goto unlock;
747 778
748 for (i = s_i; i < hashinfo->ehash_size; i++) { 779 for (i = s_i; i < hashinfo->ehash_size; i++) {
749 struct inet_ehash_bucket *head = &hashinfo->ehash[i]; 780 struct inet_ehash_bucket *head = &hashinfo->ehash[i];
@@ -805,6 +836,9 @@ next_dying:
805done: 836done:
806 cb->args[1] = i; 837 cb->args[1] = i;
807 cb->args[2] = num; 838 cb->args[2] = num;
839unlock:
840 inet_diag_unlock_handler(handler);
841no_handler:
808 return skb->len; 842 return skb->len;
809} 843}
810 844
@@ -816,15 +850,6 @@ static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
816 nlmsg_len(nlh) < hdrlen) 850 nlmsg_len(nlh) < hdrlen)
817 return -EINVAL; 851 return -EINVAL;
818 852
819#ifdef CONFIG_KMOD
820 if (inet_diag_table[nlh->nlmsg_type] == NULL)
821 request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
822 NETLINK_INET_DIAG, nlh->nlmsg_type);
823#endif
824
825 if (inet_diag_table[nlh->nlmsg_type] == NULL)
826 return -ENOENT;
827
828 if (nlh->nlmsg_flags & NLM_F_DUMP) { 853 if (nlh->nlmsg_flags & NLM_F_DUMP) {
829 if (nlmsg_attrlen(nlh, hdrlen)) { 854 if (nlmsg_attrlen(nlh, hdrlen)) {
830 struct nlattr *attr; 855 struct nlattr *attr;
@@ -853,8 +878,6 @@ static void inet_diag_rcv(struct sk_buff *skb)
853 mutex_unlock(&inet_diag_mutex); 878 mutex_unlock(&inet_diag_mutex);
854} 879}
855 880
856static DEFINE_SPINLOCK(inet_diag_register_lock);
857
858int inet_diag_register(const struct inet_diag_handler *h) 881int inet_diag_register(const struct inet_diag_handler *h)
859{ 882{
860 const __u16 type = h->idiag_type; 883 const __u16 type = h->idiag_type;
@@ -863,13 +886,13 @@ int inet_diag_register(const struct inet_diag_handler *h)
863 if (type >= INET_DIAG_GETSOCK_MAX) 886 if (type >= INET_DIAG_GETSOCK_MAX)
864 goto out; 887 goto out;
865 888
866 spin_lock(&inet_diag_register_lock); 889 mutex_lock(&inet_diag_table_mutex);
867 err = -EEXIST; 890 err = -EEXIST;
868 if (inet_diag_table[type] == NULL) { 891 if (inet_diag_table[type] == NULL) {
869 inet_diag_table[type] = h; 892 inet_diag_table[type] = h;
870 err = 0; 893 err = 0;
871 } 894 }
872 spin_unlock(&inet_diag_register_lock); 895 mutex_unlock(&inet_diag_table_mutex);
873out: 896out:
874 return err; 897 return err;
875} 898}
@@ -882,11 +905,9 @@ void inet_diag_unregister(const struct inet_diag_handler *h)
882 if (type >= INET_DIAG_GETSOCK_MAX) 905 if (type >= INET_DIAG_GETSOCK_MAX)
883 return; 906 return;
884 907
885 spin_lock(&inet_diag_register_lock); 908 mutex_lock(&inet_diag_table_mutex);
886 inet_diag_table[type] = NULL; 909 inet_diag_table[type] = NULL;
887 spin_unlock(&inet_diag_register_lock); 910 mutex_unlock(&inet_diag_table_mutex);
888
889 synchronize_rcu();
890} 911}
891EXPORT_SYMBOL_GPL(inet_diag_unregister); 912EXPORT_SYMBOL_GPL(inet_diag_unregister);
892 913
diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c
index 64f1cbaf96e8..5aa5f5496d6d 100644
--- a/net/ipv4/tcp_illinois.c
+++ b/net/ipv4/tcp_illinois.c
@@ -298,7 +298,7 @@ static u32 tcp_illinois_ssthresh(struct sock *sk)
298 struct illinois *ca = inet_csk_ca(sk); 298 struct illinois *ca = inet_csk_ca(sk);
299 299
300 /* Multiplicative decrease */ 300 /* Multiplicative decrease */
301 return max((tp->snd_cwnd * ca->beta) >> BETA_SHIFT, 2U); 301 return max(tp->snd_cwnd - ((tp->snd_cwnd * ca->beta) >> BETA_SHIFT), 2U);
302} 302}
303 303
304 304
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 567664eac463..e8c347579da9 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2293,6 +2293,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
2293 break; 2293 break;
2294 } 2294 }
2295 2295
2296 if (!idev && dev->mtu >= IPV6_MIN_MTU)
2297 idev = ipv6_add_dev(dev);
2298
2296 if (idev) 2299 if (idev)
2297 idev->if_flags |= IF_READY; 2300 idev->if_flags |= IF_READY;
2298 } else { 2301 } else {
@@ -2357,12 +2360,18 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
2357 break; 2360 break;
2358 2361
2359 case NETDEV_CHANGEMTU: 2362 case NETDEV_CHANGEMTU:
2360 if ( idev && dev->mtu >= IPV6_MIN_MTU) { 2363 if (idev && dev->mtu >= IPV6_MIN_MTU) {
2361 rt6_mtu_change(dev, dev->mtu); 2364 rt6_mtu_change(dev, dev->mtu);
2362 idev->cnf.mtu6 = dev->mtu; 2365 idev->cnf.mtu6 = dev->mtu;
2363 break; 2366 break;
2364 } 2367 }
2365 2368
2369 if (!idev && dev->mtu >= IPV6_MIN_MTU) {
2370 idev = ipv6_add_dev(dev);
2371 if (idev)
2372 break;
2373 }
2374
2366 /* MTU falled under IPV6_MIN_MTU. Stop IPv6 on this interface. */ 2375 /* MTU falled under IPV6_MIN_MTU. Stop IPv6 on this interface. */
2367 2376
2368 case NETDEV_DOWN: 2377 case NETDEV_DOWN:
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 59350b8727ec..505af1f067ab 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -216,6 +216,7 @@ static int ieee80211_open(struct net_device *dev)
216 res = local->ops->start(local_to_hw(local)); 216 res = local->ops->start(local_to_hw(local));
217 if (res) 217 if (res)
218 return res; 218 return res;
219 ieee80211_hw_config(local);
219 } 220 }
220 221
221 switch (sdata->type) { 222 switch (sdata->type) {
@@ -232,7 +233,6 @@ static int ieee80211_open(struct net_device *dev)
232 netif_tx_unlock_bh(local->mdev); 233 netif_tx_unlock_bh(local->mdev);
233 234
234 local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP; 235 local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP;
235 ieee80211_hw_config(local);
236 } 236 }
237 break; 237 break;
238 case IEEE80211_IF_TYPE_STA: 238 case IEEE80211_IF_TYPE_STA:
@@ -334,8 +334,7 @@ static int ieee80211_stop(struct net_device *dev)
334 ieee80211_configure_filter(local); 334 ieee80211_configure_filter(local);
335 netif_tx_unlock_bh(local->mdev); 335 netif_tx_unlock_bh(local->mdev);
336 336
337 local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP; 337 local->hw.conf.flags &= ~IEEE80211_CONF_RADIOTAP;
338 ieee80211_hw_config(local);
339 } 338 }
340 break; 339 break;
341 case IEEE80211_IF_TYPE_STA: 340 case IEEE80211_IF_TYPE_STA:
@@ -357,6 +356,11 @@ static int ieee80211_stop(struct net_device *dev)
357 cancel_delayed_work(&local->scan_work); 356 cancel_delayed_work(&local->scan_work);
358 } 357 }
359 flush_workqueue(local->hw.workqueue); 358 flush_workqueue(local->hw.workqueue);
359
360 sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED;
361 kfree(sdata->u.sta.extra_ie);
362 sdata->u.sta.extra_ie = NULL;
363 sdata->u.sta.extra_ie_len = 0;
360 /* fall through */ 364 /* fall through */
361 default: 365 default:
362 conf.if_id = dev->ifindex; 366 conf.if_id = dev->ifindex;
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 428a9fcf57d6..00f908d9275e 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -997,7 +997,7 @@ ieee80211_rx_h_drop_unencrypted(struct ieee80211_txrx_data *rx)
997 if (unlikely(!(rx->fc & IEEE80211_FCTL_PROTECTED) && 997 if (unlikely(!(rx->fc & IEEE80211_FCTL_PROTECTED) &&
998 (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA && 998 (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA &&
999 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_NULLFUNC && 999 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_NULLFUNC &&
1000 rx->sdata->drop_unencrypted && 1000 (rx->key || rx->sdata->drop_unencrypted) &&
1001 (rx->sdata->eapol == 0 || !ieee80211_is_eapol(rx->skb)))) { 1001 (rx->sdata->eapol == 0 || !ieee80211_is_eapol(rx->skb)))) {
1002 if (net_ratelimit()) 1002 if (net_ratelimit())
1003 printk(KERN_DEBUG "%s: RX non-WEP frame, but expected " 1003 printk(KERN_DEBUG "%s: RX non-WEP frame, but expected "
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 9bf0e1cc530a..b5f3413403bd 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -265,7 +265,8 @@ int ieee80211_wep_decrypt(struct ieee80211_local *local, struct sk_buff *skb,
265 if (ieee80211_wep_decrypt_data(local->wep_rx_tfm, rc4key, klen, 265 if (ieee80211_wep_decrypt_data(local->wep_rx_tfm, rc4key, klen,
266 skb->data + hdrlen + WEP_IV_LEN, 266 skb->data + hdrlen + WEP_IV_LEN,
267 len)) { 267 len)) {
268 printk(KERN_DEBUG "WEP decrypt failed (ICV)\n"); 268 if (net_ratelimit())
269 printk(KERN_DEBUG "WEP decrypt failed (ICV)\n");
269 ret = -1; 270 ret = -1;
270 } 271 }
271 272
diff --git a/net/netfilter/xt_CONNMARK.c b/net/netfilter/xt_CONNMARK.c
index 856793e8db7a..0621ca7de3b0 100644
--- a/net/netfilter/xt_CONNMARK.c
+++ b/net/netfilter/xt_CONNMARK.c
@@ -86,11 +86,6 @@ checkentry(const char *tablename,
86{ 86{
87 const struct xt_connmark_target_info *matchinfo = targinfo; 87 const struct xt_connmark_target_info *matchinfo = targinfo;
88 88
89 if (nf_ct_l3proto_try_module_get(target->family) < 0) {
90 printk(KERN_WARNING "can't load conntrack support for "
91 "proto=%d\n", target->family);
92 return false;
93 }
94 if (matchinfo->mode == XT_CONNMARK_RESTORE) { 89 if (matchinfo->mode == XT_CONNMARK_RESTORE) {
95 if (strcmp(tablename, "mangle") != 0) { 90 if (strcmp(tablename, "mangle") != 0) {
96 printk(KERN_WARNING "CONNMARK: restore can only be " 91 printk(KERN_WARNING "CONNMARK: restore can only be "
@@ -103,6 +98,11 @@ checkentry(const char *tablename,
103 printk(KERN_WARNING "CONNMARK: Only supports 32bit mark\n"); 98 printk(KERN_WARNING "CONNMARK: Only supports 32bit mark\n");
104 return false; 99 return false;
105 } 100 }
101 if (nf_ct_l3proto_try_module_get(target->family) < 0) {
102 printk(KERN_WARNING "can't load conntrack support for "
103 "proto=%d\n", target->family);
104 return false;
105 }
106 return true; 106 return true;
107} 107}
108 108
diff --git a/net/netfilter/xt_CONNSECMARK.c b/net/netfilter/xt_CONNSECMARK.c
index 021b5c8d20e2..d8feba9bdb48 100644
--- a/net/netfilter/xt_CONNSECMARK.c
+++ b/net/netfilter/xt_CONNSECMARK.c
@@ -90,11 +90,6 @@ static bool checkentry(const char *tablename, const void *entry,
90{ 90{
91 const struct xt_connsecmark_target_info *info = targinfo; 91 const struct xt_connsecmark_target_info *info = targinfo;
92 92
93 if (nf_ct_l3proto_try_module_get(target->family) < 0) {
94 printk(KERN_WARNING "can't load conntrack support for "
95 "proto=%d\n", target->family);
96 return false;
97 }
98 switch (info->mode) { 93 switch (info->mode) {
99 case CONNSECMARK_SAVE: 94 case CONNSECMARK_SAVE:
100 case CONNSECMARK_RESTORE: 95 case CONNSECMARK_RESTORE:
@@ -105,6 +100,11 @@ static bool checkentry(const char *tablename, const void *entry,
105 return false; 100 return false;
106 } 101 }
107 102
103 if (nf_ct_l3proto_try_module_get(target->family) < 0) {
104 printk(KERN_WARNING "can't load conntrack support for "
105 "proto=%d\n", target->family);
106 return false;
107 }
108 return true; 108 return true;
109} 109}
110 110
diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c
index 07435a602b11..8e76d1f52fbe 100644
--- a/net/netfilter/xt_TCPMSS.c
+++ b/net/netfilter/xt_TCPMSS.c
@@ -174,10 +174,8 @@ xt_tcpmss_target6(struct sk_buff *skb,
174 174
175 nexthdr = ipv6h->nexthdr; 175 nexthdr = ipv6h->nexthdr;
176 tcphoff = ipv6_skip_exthdr(skb, sizeof(*ipv6h), &nexthdr); 176 tcphoff = ipv6_skip_exthdr(skb, sizeof(*ipv6h), &nexthdr);
177 if (tcphoff < 0) { 177 if (tcphoff < 0)
178 WARN_ON(1);
179 return NF_DROP; 178 return NF_DROP;
180 }
181 ret = tcpmss_mangle_packet(skb, targinfo, tcphoff, 179 ret = tcpmss_mangle_packet(skb, targinfo, tcphoff,
182 sizeof(*ipv6h) + sizeof(struct tcphdr)); 180 sizeof(*ipv6h) + sizeof(struct tcphdr));
183 if (ret < 0) 181 if (ret < 0)
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 73d60a307129..4469a7be006c 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -60,11 +60,7 @@ static void rfkill_led_trigger(struct rfkill *rfkill,
60static int rfkill_toggle_radio(struct rfkill *rfkill, 60static int rfkill_toggle_radio(struct rfkill *rfkill,
61 enum rfkill_state state) 61 enum rfkill_state state)
62{ 62{
63 int retval; 63 int retval = 0;
64
65 retval = mutex_lock_interruptible(&rfkill->mutex);
66 if (retval)
67 return retval;
68 64
69 if (state != rfkill->state) { 65 if (state != rfkill->state) {
70 retval = rfkill->toggle_radio(rfkill->data, state); 66 retval = rfkill->toggle_radio(rfkill->data, state);
@@ -74,7 +70,6 @@ static int rfkill_toggle_radio(struct rfkill *rfkill,
74 } 70 }
75 } 71 }
76 72
77 mutex_unlock(&rfkill->mutex);
78 return retval; 73 return retval;
79} 74}
80 75
@@ -158,12 +153,13 @@ static ssize_t rfkill_state_store(struct device *dev,
158 if (!capable(CAP_NET_ADMIN)) 153 if (!capable(CAP_NET_ADMIN))
159 return -EPERM; 154 return -EPERM;
160 155
156 if (mutex_lock_interruptible(&rfkill->mutex))
157 return -ERESTARTSYS;
161 error = rfkill_toggle_radio(rfkill, 158 error = rfkill_toggle_radio(rfkill,
162 state ? RFKILL_STATE_ON : RFKILL_STATE_OFF); 159 state ? RFKILL_STATE_ON : RFKILL_STATE_OFF);
163 if (error) 160 mutex_unlock(&rfkill->mutex);
164 return error;
165 161
166 return count; 162 return error ? error : count;
167} 163}
168 164
169static ssize_t rfkill_claim_show(struct device *dev, 165static ssize_t rfkill_claim_show(struct device *dev,
diff --git a/net/rxrpc/Kconfig b/net/rxrpc/Kconfig
index e662f1d07664..0d3103c4f11c 100644
--- a/net/rxrpc/Kconfig
+++ b/net/rxrpc/Kconfig
@@ -5,6 +5,7 @@
5config AF_RXRPC 5config AF_RXRPC
6 tristate "RxRPC session sockets" 6 tristate "RxRPC session sockets"
7 depends on INET && EXPERIMENTAL 7 depends on INET && EXPERIMENTAL
8 select CRYPTO
8 select KEYS 9 select KEYS
9 help 10 help
10 Say Y or M here to include support for RxRPC session sockets (just 11 Say Y or M here to include support for RxRPC session sockets (just
diff --git a/net/sctp/Kconfig b/net/sctp/Kconfig
index 8210f549c492..5390bc792159 100644
--- a/net/sctp/Kconfig
+++ b/net/sctp/Kconfig
@@ -6,9 +6,9 @@ menuconfig IP_SCTP
6 tristate "The SCTP Protocol (EXPERIMENTAL)" 6 tristate "The SCTP Protocol (EXPERIMENTAL)"
7 depends on INET && EXPERIMENTAL 7 depends on INET && EXPERIMENTAL
8 depends on IPV6 || IPV6=n 8 depends on IPV6 || IPV6=n
9 select CRYPTO if SCTP_HMAC_SHA1 || SCTP_HMAC_MD5 9 select CRYPTO
10 select CRYPTO_HMAC if SCTP_HMAC_SHA1 || SCTP_HMAC_MD5 10 select CRYPTO_HMAC
11 select CRYPTO_SHA1 if SCTP_HMAC_SHA1 11 select CRYPTO_SHA1
12 select CRYPTO_MD5 if SCTP_HMAC_MD5 12 select CRYPTO_MD5 if SCTP_HMAC_MD5
13 ---help--- 13 ---help---
14 Stream Control Transmission Protocol 14 Stream Control Transmission Protocol
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index 6d5fa6bb371b..97e6ebd14500 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -54,11 +54,13 @@ static struct sctp_hmac sctp_hmac_list[SCTP_AUTH_NUM_HMACS] = {
54 /* id 2 is reserved as well */ 54 /* id 2 is reserved as well */
55 .hmac_id = SCTP_AUTH_HMAC_ID_RESERVED_2, 55 .hmac_id = SCTP_AUTH_HMAC_ID_RESERVED_2,
56 }, 56 },
57#if defined (CONFIG_CRYPTO_SHA256) || defined (CONFIG_CRYPTO_SHA256_MODULE)
57 { 58 {
58 .hmac_id = SCTP_AUTH_HMAC_ID_SHA256, 59 .hmac_id = SCTP_AUTH_HMAC_ID_SHA256,
59 .hmac_name="hmac(sha256)", 60 .hmac_name="hmac(sha256)",
60 .hmac_len = SCTP_SHA256_SIG_SIZE, 61 .hmac_len = SCTP_SHA256_SIG_SIZE,
61 } 62 }
63#endif
62}; 64};
63 65
64 66
@@ -631,7 +633,7 @@ static int __sctp_auth_cid(sctp_cid_t chunk, struct sctp_chunks_param *param)
631 int found = 0; 633 int found = 0;
632 int i; 634 int i;
633 635
634 if (!param) 636 if (!param || param->param_hdr.length == 0)
635 return 0; 637 return 0;
636 638
637 len = ntohs(param->param_hdr.length) - sizeof(sctp_paramhdr_t); 639 len = ntohs(param->param_hdr.length) - sizeof(sctp_paramhdr_t);
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 5a9783c38de1..f4876291bb5e 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -77,6 +77,8 @@ static int sctp_process_param(struct sctp_association *asoc,
77 union sctp_params param, 77 union sctp_params param,
78 const union sctp_addr *peer_addr, 78 const union sctp_addr *peer_addr,
79 gfp_t gfp); 79 gfp_t gfp);
80static void *sctp_addto_param(struct sctp_chunk *chunk, int len,
81 const void *data);
80 82
81/* What was the inbound interface for this chunk? */ 83/* What was the inbound interface for this chunk? */
82int sctp_chunk_iif(const struct sctp_chunk *chunk) 84int sctp_chunk_iif(const struct sctp_chunk *chunk)
@@ -207,11 +209,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
207 209
208 chunksize = sizeof(init) + addrs_len + SCTP_SAT_LEN(num_types); 210 chunksize = sizeof(init) + addrs_len + SCTP_SAT_LEN(num_types);
209 chunksize += sizeof(ecap_param); 211 chunksize += sizeof(ecap_param);
210 if (sctp_prsctp_enable) { 212
211 chunksize += sizeof(prsctp_param);
212 extensions[num_ext] = SCTP_CID_FWD_TSN;
213 num_ext += 1;
214 }
215 /* ADDIP: Section 4.2.7: 213 /* ADDIP: Section 4.2.7:
216 * An implementation supporting this extension [ADDIP] MUST list 214 * An implementation supporting this extension [ADDIP] MUST list
217 * the ASCONF,the ASCONF-ACK, and the AUTH chunks in its INIT and 215 * the ASCONF,the ASCONF-ACK, and the AUTH chunks in its INIT and
@@ -243,7 +241,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
243 if (auth_chunks->length) 241 if (auth_chunks->length)
244 chunksize += ntohs(auth_chunks->length); 242 chunksize += ntohs(auth_chunks->length);
245 else 243 else
246 auth_hmacs = NULL; 244 auth_chunks = NULL;
247 245
248 extensions[num_ext] = SCTP_CID_AUTH; 246 extensions[num_ext] = SCTP_CID_AUTH;
249 num_ext += 1; 247 num_ext += 1;
@@ -297,7 +295,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
297 htons(sizeof(sctp_supported_ext_param_t) + num_ext); 295 htons(sizeof(sctp_supported_ext_param_t) + num_ext);
298 sctp_addto_chunk(retval, sizeof(sctp_supported_ext_param_t), 296 sctp_addto_chunk(retval, sizeof(sctp_supported_ext_param_t),
299 &ext_param); 297 &ext_param);
300 sctp_addto_chunk(retval, num_ext, extensions); 298 sctp_addto_param(retval, num_ext, extensions);
301 } 299 }
302 300
303 if (sctp_prsctp_enable) 301 if (sctp_prsctp_enable)
@@ -371,20 +369,12 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
371 if (asoc->peer.ecn_capable) 369 if (asoc->peer.ecn_capable)
372 chunksize += sizeof(ecap_param); 370 chunksize += sizeof(ecap_param);
373 371
374 /* Tell peer that we'll do PR-SCTP only if peer advertised. */
375 if (asoc->peer.prsctp_capable) {
376 chunksize += sizeof(prsctp_param);
377 extensions[num_ext] = SCTP_CID_FWD_TSN;
378 num_ext += 1;
379 }
380
381 if (sctp_addip_enable) { 372 if (sctp_addip_enable) {
382 extensions[num_ext] = SCTP_CID_ASCONF; 373 extensions[num_ext] = SCTP_CID_ASCONF;
383 extensions[num_ext+1] = SCTP_CID_ASCONF_ACK; 374 extensions[num_ext+1] = SCTP_CID_ASCONF_ACK;
384 num_ext += 2; 375 num_ext += 2;
385 } 376 }
386 377
387 chunksize += sizeof(ext_param) + num_ext;
388 chunksize += sizeof(aiparam); 378 chunksize += sizeof(aiparam);
389 379
390 if (asoc->peer.auth_capable) { 380 if (asoc->peer.auth_capable) {
@@ -407,6 +397,9 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
407 num_ext += 1; 397 num_ext += 1;
408 } 398 }
409 399
400 if (num_ext)
401 chunksize += sizeof(sctp_supported_ext_param_t) + num_ext;
402
410 /* Now allocate and fill out the chunk. */ 403 /* Now allocate and fill out the chunk. */
411 retval = sctp_make_chunk(asoc, SCTP_CID_INIT_ACK, 0, chunksize); 404 retval = sctp_make_chunk(asoc, SCTP_CID_INIT_ACK, 0, chunksize);
412 if (!retval) 405 if (!retval)
@@ -428,7 +421,7 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
428 htons(sizeof(sctp_supported_ext_param_t) + num_ext); 421 htons(sizeof(sctp_supported_ext_param_t) + num_ext);
429 sctp_addto_chunk(retval, sizeof(sctp_supported_ext_param_t), 422 sctp_addto_chunk(retval, sizeof(sctp_supported_ext_param_t),
430 &ext_param); 423 &ext_param);
431 sctp_addto_chunk(retval, num_ext, extensions); 424 sctp_addto_param(retval, num_ext, extensions);
432 } 425 }
433 if (asoc->peer.prsctp_capable) 426 if (asoc->peer.prsctp_capable)
434 sctp_addto_chunk(retval, sizeof(prsctp_param), &prsctp_param); 427 sctp_addto_chunk(retval, sizeof(prsctp_param), &prsctp_param);
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index b8bbb960723c..5fb84778846d 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -959,7 +959,7 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep,
959{ 959{
960 struct sctp_transport *transport = (struct sctp_transport *) arg; 960 struct sctp_transport *transport = (struct sctp_transport *) arg;
961 961
962 if (asoc->overall_error_count >= asoc->max_retrans) { 962 if (asoc->overall_error_count > asoc->max_retrans) {
963 sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, 963 sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
964 SCTP_ERROR(ETIMEDOUT)); 964 SCTP_ERROR(ETIMEDOUT));
965 /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */ 965 /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index e835da8fc091..060bba4567d2 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1637,8 +1637,15 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock,
1637 mutex_lock(&u->readlock); 1637 mutex_lock(&u->readlock);
1638 1638
1639 skb = skb_recv_datagram(sk, flags, noblock, &err); 1639 skb = skb_recv_datagram(sk, flags, noblock, &err);
1640 if (!skb) 1640 if (!skb) {
1641 unix_state_lock(sk);
1642 /* Signal EOF on disconnected non-blocking SEQPACKET socket. */
1643 if (sk->sk_type == SOCK_SEQPACKET && err == -EAGAIN &&
1644 (sk->sk_shutdown & RCV_SHUTDOWN))
1645 err = 0;
1646 unix_state_unlock(sk);
1641 goto out_unlock; 1647 goto out_unlock;
1648 }
1642 1649
1643 wake_up_interruptible_sync(&u->peer_wait); 1650 wake_up_interruptible_sync(&u->peer_wait);
1644 1651
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index b702bd8a3893..9a4cf2e45a15 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1344,6 +1344,7 @@ restart:
1344 xfrm_nr += pols[0]->xfrm_nr; 1344 xfrm_nr += pols[0]->xfrm_nr;
1345 1345
1346 switch (policy->action) { 1346 switch (policy->action) {
1347 default:
1347 case XFRM_POLICY_BLOCK: 1348 case XFRM_POLICY_BLOCK:
1348 /* Prohibit the flow */ 1349 /* Prohibit the flow */
1349 err = -EPERM; 1350 err = -EPERM;