aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-09-22 21:23:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-09-22 21:23:33 -0400
commit98f75b8291a89ba6bf73e322ee467ce0bfeb91c1 (patch)
treec9f61617d49973d2d8fc684183be0ce1820a0338 /net
parent9478303619bc87c575e894d867049b25f33bf124 (diff)
parente18b7faae15dbd47e5811ed748bd5b500dcfaa2d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) If the user gives us a msg_namelen of 0, don't try to interpret anything pointed to by msg_name. From Ani Sinha. 2) Fix some bnx2i/bnx2fc randconfig compilation errors. The gist of the issue is that we firstly have drivers that span both SCSI and networking. And at the top of that chain of dependencies we have things like SCSI_FC_ATTRS and SCSI_NETLINK which are selected. But since select is a sledgehammer and ignores dependencies, everything to select's SCSI_FC_ATTRS and/or SCSI_NETLINK has to also explicitly select their dependencies and so on and so forth. Generally speaking 'select' is supposed to only be used for child nodes, those which have no dependencies of their own. And this whole chain of dependencies in the scsi layer violates that rather strongly. So just make SCSI_NETLINK depend upon it's dependencies, and so on and so forth for the things selecting it (either directly or indirectly). From Anish Bhatt and Randy Dunlap. 3) Fix generation of blackhole routes in IPSEC, from Steffen Klassert. 4) Actually notice netdev feature changes in rtl_open() code, from Hayes Wang. 5) Fix divide by zero in bond enslaving, from Nikolay Aleksandrov. 6) Missing memory barrier in sunvnet driver, from David Stevens. 7) Don't leave anycast addresses around when ipv6 interface is destroyed, from Sabrina Dubroca. 8) Don't call efx_{arch}_filter_sync_rx_mode before addr_list_lock is initialized in SFC driver, from Edward Cree. 9) Fix missing DMA error checking in 3c59x, from Neal Horman. 10) Openvswitch doesn't emit OVS_FLOW_CMD_NEW notifications accidently, fix from Samuel Gauthier. 11) pch_gbe needs to select NET_PTP_CLASSIFY otherwise we can get a build error. 12) Fix macvlan regression wherein we stopped emitting broadcast/multicast frames over software devices. From Nicolas Dichtel. 13) Fix infiniband bug due to unintended overflow of skb->cb[], from Eric Dumazet. And add an assertion so this doesn't happen again. 14) dm9000_parse_dt() should return error pointers, not NULL. From Tobias Klauser. 15) IP tunneling code uses this_cpu_ptr() in preemptible contexts, fix from Eric Dumazet. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (87 commits) net: bcmgenet: call bcmgenet_dma_teardown in bcmgenet_fini_dma net: bcmgenet: fix TX reclaim accounting for fragments ipv4: do not use this_cpu_ptr() in preemptible context dm9000: Return an ERR_PTR() in all error conditions of dm9000_parse_dt() r8169: fix an if condition r8152: disable ALDPS ipoib: validate struct ipoib_cb size net: sched: shrink struct qdisc_skb_cb to 28 bytes tg3: Work around HW/FW limitations with vlan encapsulated frames macvlan: allow to enqueue broadcast pkt on virtual device pch_gbe: 'select' NET_PTP_CLASSIFY. scsi: Use 'depends' with LIBFC instead of 'select'. openvswitch: restore OVS_FLOW_CMD_NEW notifications genetlink: add function genl_has_listeners() lib: rhashtable: remove second linux/log2.h inclusion net: allow macvlans to move to net namespace 3c59x: Fix bad offset spec in skb_frag_dma_map 3c59x: Add dma error checking and recovery sparc: bpf_jit: fix support for ldx/stx mem and SKF_AD_VLAN_TAG can: at91_can: add missing prepare and unprepare of the clock ...
Diffstat (limited to 'net')
-rw-r--r--net/bridge/br_private.h3
-rw-r--r--net/bridge/br_vlan.c16
-rw-r--r--net/core/dev.c18
-rw-r--r--net/core/sock.c2
-rw-r--r--net/ipv4/ip_tunnel.c6
-rw-r--r--net/ipv4/route.c6
-rw-r--r--net/ipv6/addrconf.c8
-rw-r--r--net/ipv6/anycast.c21
-rw-r--r--net/ipv6/ip6_output.c4
-rw-r--r--net/mac80211/sta_info.c2
-rw-r--r--net/openvswitch/datapath.c9
-rw-r--r--net/rfkill/rfkill-gpio.c1
-rw-r--r--net/rxrpc/ar-key.c2
-rw-r--r--net/sched/sch_choke.c18
-rw-r--r--net/socket.c3
-rw-r--r--net/wireless/nl80211.c6
-rw-r--r--net/xfrm/xfrm_policy.c48
17 files changed, 133 insertions, 40 deletions
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 62a7fa2e3569..b6c04cbcfdc5 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -309,6 +309,9 @@ struct br_input_skb_cb {
309 int igmp; 309 int igmp;
310 int mrouters_only; 310 int mrouters_only;
311#endif 311#endif
312#ifdef CONFIG_BRIDGE_VLAN_FILTERING
313 bool vlan_filtered;
314#endif
312}; 315};
313 316
314#define BR_INPUT_SKB_CB(__skb) ((struct br_input_skb_cb *)(__skb)->cb) 317#define BR_INPUT_SKB_CB(__skb) ((struct br_input_skb_cb *)(__skb)->cb)
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index e1bcd653899b..3ba57fcdcd13 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -27,9 +27,13 @@ static void __vlan_add_flags(struct net_port_vlans *v, u16 vid, u16 flags)
27{ 27{
28 if (flags & BRIDGE_VLAN_INFO_PVID) 28 if (flags & BRIDGE_VLAN_INFO_PVID)
29 __vlan_add_pvid(v, vid); 29 __vlan_add_pvid(v, vid);
30 else
31 __vlan_delete_pvid(v, vid);
30 32
31 if (flags & BRIDGE_VLAN_INFO_UNTAGGED) 33 if (flags & BRIDGE_VLAN_INFO_UNTAGGED)
32 set_bit(vid, v->untagged_bitmap); 34 set_bit(vid, v->untagged_bitmap);
35 else
36 clear_bit(vid, v->untagged_bitmap);
33} 37}
34 38
35static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags) 39static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags)
@@ -125,7 +129,8 @@ struct sk_buff *br_handle_vlan(struct net_bridge *br,
125{ 129{
126 u16 vid; 130 u16 vid;
127 131
128 if (!br->vlan_enabled) 132 /* If this packet was not filtered at input, let it pass */
133 if (!BR_INPUT_SKB_CB(skb)->vlan_filtered)
129 goto out; 134 goto out;
130 135
131 /* Vlan filter table must be configured at this point. The 136 /* Vlan filter table must be configured at this point. The
@@ -164,8 +169,10 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v,
164 /* If VLAN filtering is disabled on the bridge, all packets are 169 /* If VLAN filtering is disabled on the bridge, all packets are
165 * permitted. 170 * permitted.
166 */ 171 */
167 if (!br->vlan_enabled) 172 if (!br->vlan_enabled) {
173 BR_INPUT_SKB_CB(skb)->vlan_filtered = false;
168 return true; 174 return true;
175 }
169 176
170 /* If there are no vlan in the permitted list, all packets are 177 /* If there are no vlan in the permitted list, all packets are
171 * rejected. 178 * rejected.
@@ -173,6 +180,7 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v,
173 if (!v) 180 if (!v)
174 goto drop; 181 goto drop;
175 182
183 BR_INPUT_SKB_CB(skb)->vlan_filtered = true;
176 proto = br->vlan_proto; 184 proto = br->vlan_proto;
177 185
178 /* If vlan tx offload is disabled on bridge device and frame was 186 /* If vlan tx offload is disabled on bridge device and frame was
@@ -251,7 +259,8 @@ bool br_allowed_egress(struct net_bridge *br,
251{ 259{
252 u16 vid; 260 u16 vid;
253 261
254 if (!br->vlan_enabled) 262 /* If this packet was not filtered at input, let it pass */
263 if (!BR_INPUT_SKB_CB(skb)->vlan_filtered)
255 return true; 264 return true;
256 265
257 if (!v) 266 if (!v)
@@ -270,6 +279,7 @@ bool br_should_learn(struct net_bridge_port *p, struct sk_buff *skb, u16 *vid)
270 struct net_bridge *br = p->br; 279 struct net_bridge *br = p->br;
271 struct net_port_vlans *v; 280 struct net_port_vlans *v;
272 281
282 /* If filtering was disabled at input, let it pass. */
273 if (!br->vlan_enabled) 283 if (!br->vlan_enabled)
274 return true; 284 return true;
275 285
diff --git a/net/core/dev.c b/net/core/dev.c
index ab9a16530c36..cf8a95f48cff 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4809,9 +4809,14 @@ static void netdev_adjacent_sysfs_del(struct net_device *dev,
4809 sysfs_remove_link(&(dev->dev.kobj), linkname); 4809 sysfs_remove_link(&(dev->dev.kobj), linkname);
4810} 4810}
4811 4811
4812#define netdev_adjacent_is_neigh_list(dev, dev_list) \ 4812static inline bool netdev_adjacent_is_neigh_list(struct net_device *dev,
4813 (dev_list == &dev->adj_list.upper || \ 4813 struct net_device *adj_dev,
4814 dev_list == &dev->adj_list.lower) 4814 struct list_head *dev_list)
4815{
4816 return (dev_list == &dev->adj_list.upper ||
4817 dev_list == &dev->adj_list.lower) &&
4818 net_eq(dev_net(dev), dev_net(adj_dev));
4819}
4815 4820
4816static int __netdev_adjacent_dev_insert(struct net_device *dev, 4821static int __netdev_adjacent_dev_insert(struct net_device *dev,
4817 struct net_device *adj_dev, 4822 struct net_device *adj_dev,
@@ -4841,7 +4846,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev,
4841 pr_debug("dev_hold for %s, because of link added from %s to %s\n", 4846 pr_debug("dev_hold for %s, because of link added from %s to %s\n",
4842 adj_dev->name, dev->name, adj_dev->name); 4847 adj_dev->name, dev->name, adj_dev->name);
4843 4848
4844 if (netdev_adjacent_is_neigh_list(dev, dev_list)) { 4849 if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list)) {
4845 ret = netdev_adjacent_sysfs_add(dev, adj_dev, dev_list); 4850 ret = netdev_adjacent_sysfs_add(dev, adj_dev, dev_list);
4846 if (ret) 4851 if (ret)
4847 goto free_adj; 4852 goto free_adj;
@@ -4862,7 +4867,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev,
4862 return 0; 4867 return 0;
4863 4868
4864remove_symlinks: 4869remove_symlinks:
4865 if (netdev_adjacent_is_neigh_list(dev, dev_list)) 4870 if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list))
4866 netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); 4871 netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list);
4867free_adj: 4872free_adj:
4868 kfree(adj); 4873 kfree(adj);
@@ -4895,8 +4900,7 @@ static void __netdev_adjacent_dev_remove(struct net_device *dev,
4895 if (adj->master) 4900 if (adj->master)
4896 sysfs_remove_link(&(dev->dev.kobj), "master"); 4901 sysfs_remove_link(&(dev->dev.kobj), "master");
4897 4902
4898 if (netdev_adjacent_is_neigh_list(dev, dev_list) && 4903 if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list))
4899 net_eq(dev_net(dev),dev_net(adj_dev)))
4900 netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); 4904 netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list);
4901 4905
4902 list_del_rcu(&adj->list); 4906 list_del_rcu(&adj->list);
diff --git a/net/core/sock.c b/net/core/sock.c
index d372b4bd3f99..9c3f823e76a9 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1866,7 +1866,7 @@ EXPORT_SYMBOL(sock_alloc_send_skb);
1866 * skb_page_frag_refill - check that a page_frag contains enough room 1866 * skb_page_frag_refill - check that a page_frag contains enough room
1867 * @sz: minimum size of the fragment we want to get 1867 * @sz: minimum size of the fragment we want to get
1868 * @pfrag: pointer to page_frag 1868 * @pfrag: pointer to page_frag
1869 * @prio: priority for memory allocation 1869 * @gfp: priority for memory allocation
1870 * 1870 *
1871 * Note: While this allocator tries to use high order pages, there is 1871 * Note: While this allocator tries to use high order pages, there is
1872 * no guarantee that allocations succeed. Therefore, @sz MUST be 1872 * no guarantee that allocations succeed. Therefore, @sz MUST be
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index afed1aac2638..bd41dd1948b6 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -79,10 +79,10 @@ static void __tunnel_dst_set(struct ip_tunnel_dst *idst,
79 idst->saddr = saddr; 79 idst->saddr = saddr;
80} 80}
81 81
82static void tunnel_dst_set(struct ip_tunnel *t, 82static noinline void tunnel_dst_set(struct ip_tunnel *t,
83 struct dst_entry *dst, __be32 saddr) 83 struct dst_entry *dst, __be32 saddr)
84{ 84{
85 __tunnel_dst_set(this_cpu_ptr(t->dst_cache), dst, saddr); 85 __tunnel_dst_set(raw_cpu_ptr(t->dst_cache), dst, saddr);
86} 86}
87 87
88static void tunnel_dst_reset(struct ip_tunnel *t) 88static void tunnel_dst_reset(struct ip_tunnel *t)
@@ -106,7 +106,7 @@ static struct rtable *tunnel_rtable_get(struct ip_tunnel *t,
106 struct dst_entry *dst; 106 struct dst_entry *dst;
107 107
108 rcu_read_lock(); 108 rcu_read_lock();
109 idst = this_cpu_ptr(t->dst_cache); 109 idst = raw_cpu_ptr(t->dst_cache);
110 dst = rcu_dereference(idst->dst); 110 dst = rcu_dereference(idst->dst);
111 if (dst && !atomic_inc_not_zero(&dst->__refcnt)) 111 if (dst && !atomic_inc_not_zero(&dst->__refcnt))
112 dst = NULL; 112 dst = NULL;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index eaa4b000c7b4..173e7ea54c70 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2265,9 +2265,9 @@ struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4,
2265 return rt; 2265 return rt;
2266 2266
2267 if (flp4->flowi4_proto) 2267 if (flp4->flowi4_proto)
2268 rt = (struct rtable *) xfrm_lookup(net, &rt->dst, 2268 rt = (struct rtable *)xfrm_lookup_route(net, &rt->dst,
2269 flowi4_to_flowi(flp4), 2269 flowi4_to_flowi(flp4),
2270 sk, 0); 2270 sk, 0);
2271 2271
2272 return rt; 2272 return rt;
2273} 2273}
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index fc1fac2a0528..3342ee64f2e3 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3094,11 +3094,13 @@ static int addrconf_ifdown(struct net_device *dev, int how)
3094 3094
3095 write_unlock_bh(&idev->lock); 3095 write_unlock_bh(&idev->lock);
3096 3096
3097 /* Step 5: Discard multicast list */ 3097 /* Step 5: Discard anycast and multicast list */
3098 if (how) 3098 if (how) {
3099 ipv6_ac_destroy_dev(idev);
3099 ipv6_mc_destroy_dev(idev); 3100 ipv6_mc_destroy_dev(idev);
3100 else 3101 } else {
3101 ipv6_mc_down(idev); 3102 ipv6_mc_down(idev);
3103 }
3102 3104
3103 idev->tstamp = jiffies; 3105 idev->tstamp = jiffies;
3104 3106
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index ff2de7d9d8e6..9a386842fd62 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -351,6 +351,27 @@ static int ipv6_dev_ac_dec(struct net_device *dev, const struct in6_addr *addr)
351 return __ipv6_dev_ac_dec(idev, addr); 351 return __ipv6_dev_ac_dec(idev, addr);
352} 352}
353 353
354void ipv6_ac_destroy_dev(struct inet6_dev *idev)
355{
356 struct ifacaddr6 *aca;
357
358 write_lock_bh(&idev->lock);
359 while ((aca = idev->ac_list) != NULL) {
360 idev->ac_list = aca->aca_next;
361 write_unlock_bh(&idev->lock);
362
363 addrconf_leave_solict(idev, &aca->aca_addr);
364
365 dst_hold(&aca->aca_rt->dst);
366 ip6_del_rt(aca->aca_rt);
367
368 aca_put(aca);
369
370 write_lock_bh(&idev->lock);
371 }
372 write_unlock_bh(&idev->lock);
373}
374
354/* 375/*
355 * check if the interface has this anycast address 376 * check if the interface has this anycast address
356 * called with rcu_read_lock() 377 * called with rcu_read_lock()
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 315a55d66079..0a3448b2888f 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1009,7 +1009,7 @@ struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
1009 if (final_dst) 1009 if (final_dst)
1010 fl6->daddr = *final_dst; 1010 fl6->daddr = *final_dst;
1011 1011
1012 return xfrm_lookup(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); 1012 return xfrm_lookup_route(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0);
1013} 1013}
1014EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow); 1014EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow);
1015 1015
@@ -1041,7 +1041,7 @@ struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
1041 if (final_dst) 1041 if (final_dst)
1042 fl6->daddr = *final_dst; 1042 fl6->daddr = *final_dst;
1043 1043
1044 return xfrm_lookup(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); 1044 return xfrm_lookup_route(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0);
1045} 1045}
1046EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow); 1046EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow);
1047 1047
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 441875f03750..a1e433b88c66 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -1822,7 +1822,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
1822 sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; 1822 sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE;
1823 if (sdata->vif.bss_conf.use_short_slot) 1823 if (sdata->vif.bss_conf.use_short_slot)
1824 sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; 1824 sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME;
1825 sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period; 1825 sinfo->bss_param.dtim_period = sdata->vif.bss_conf.dtim_period;
1826 sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int; 1826 sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int;
1827 1827
1828 sinfo->sta_flags.set = 0; 1828 sinfo->sta_flags.set = 0;
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 91d66b7e64ac..64dc864a417f 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -78,11 +78,12 @@ static const struct genl_multicast_group ovs_dp_vport_multicast_group = {
78 78
79/* Check if need to build a reply message. 79/* Check if need to build a reply message.
80 * OVS userspace sets the NLM_F_ECHO flag if it needs the reply. */ 80 * OVS userspace sets the NLM_F_ECHO flag if it needs the reply. */
81static bool ovs_must_notify(struct genl_info *info, 81static bool ovs_must_notify(struct genl_family *family, struct genl_info *info,
82 const struct genl_multicast_group *grp) 82 unsigned int group)
83{ 83{
84 return info->nlhdr->nlmsg_flags & NLM_F_ECHO || 84 return info->nlhdr->nlmsg_flags & NLM_F_ECHO ||
85 netlink_has_listeners(genl_info_net(info)->genl_sock, 0); 85 genl_has_listeners(family, genl_info_net(info)->genl_sock,
86 group);
86} 87}
87 88
88static void ovs_notify(struct genl_family *family, 89static void ovs_notify(struct genl_family *family,
@@ -763,7 +764,7 @@ static struct sk_buff *ovs_flow_cmd_alloc_info(const struct sw_flow_actions *act
763{ 764{
764 struct sk_buff *skb; 765 struct sk_buff *skb;
765 766
766 if (!always && !ovs_must_notify(info, &ovs_dp_flow_multicast_group)) 767 if (!always && !ovs_must_notify(&dp_flow_genl_family, info, 0))
767 return NULL; 768 return NULL;
768 769
769 skb = genlmsg_new_unicast(ovs_flow_cmd_msg_size(acts), info, GFP_KERNEL); 770 skb = genlmsg_new_unicast(ovs_flow_cmd_msg_size(acts), info, GFP_KERNEL);
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index 02a86a27fd84..5fa54dd78e25 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -163,6 +163,7 @@ static const struct acpi_device_id rfkill_acpi_match[] = {
163 { "LNV4752", RFKILL_TYPE_GPS }, 163 { "LNV4752", RFKILL_TYPE_GPS },
164 { }, 164 { },
165}; 165};
166MODULE_DEVICE_TABLE(acpi, rfkill_acpi_match);
166#endif 167#endif
167 168
168static struct platform_driver rfkill_gpio_driver = { 169static struct platform_driver rfkill_gpio_driver = {
diff --git a/net/rxrpc/ar-key.c b/net/rxrpc/ar-key.c
index b45d080e64a7..1b24191167f1 100644
--- a/net/rxrpc/ar-key.c
+++ b/net/rxrpc/ar-key.c
@@ -1143,7 +1143,7 @@ static long rxrpc_read(const struct key *key,
1143 if (copy_to_user(xdr, (s), _l) != 0) \ 1143 if (copy_to_user(xdr, (s), _l) != 0) \
1144 goto fault; \ 1144 goto fault; \
1145 if (_l & 3 && \ 1145 if (_l & 3 && \
1146 copy_to_user((u8 *)xdr + _l, &zero, 4 - (_l & 3)) != 0) \ 1146 copy_to_user((u8 __user *)xdr + _l, &zero, 4 - (_l & 3)) != 0) \
1147 goto fault; \ 1147 goto fault; \
1148 xdr += (_l + 3) >> 2; \ 1148 xdr += (_l + 3) >> 2; \
1149 } while(0) 1149 } while(0)
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c
index ed30e436128b..fb666d1e4de3 100644
--- a/net/sched/sch_choke.c
+++ b/net/sched/sch_choke.c
@@ -133,10 +133,16 @@ static void choke_drop_by_idx(struct Qdisc *sch, unsigned int idx)
133 --sch->q.qlen; 133 --sch->q.qlen;
134} 134}
135 135
136/* private part of skb->cb[] that a qdisc is allowed to use
137 * is limited to QDISC_CB_PRIV_LEN bytes.
138 * As a flow key might be too large, we store a part of it only.
139 */
140#define CHOKE_K_LEN min_t(u32, sizeof(struct flow_keys), QDISC_CB_PRIV_LEN - 3)
141
136struct choke_skb_cb { 142struct choke_skb_cb {
137 u16 classid; 143 u16 classid;
138 u8 keys_valid; 144 u8 keys_valid;
139 struct flow_keys keys; 145 u8 keys[QDISC_CB_PRIV_LEN - 3];
140}; 146};
141 147
142static inline struct choke_skb_cb *choke_skb_cb(const struct sk_buff *skb) 148static inline struct choke_skb_cb *choke_skb_cb(const struct sk_buff *skb)
@@ -163,22 +169,26 @@ static u16 choke_get_classid(const struct sk_buff *skb)
163static bool choke_match_flow(struct sk_buff *skb1, 169static bool choke_match_flow(struct sk_buff *skb1,
164 struct sk_buff *skb2) 170 struct sk_buff *skb2)
165{ 171{
172 struct flow_keys temp;
173
166 if (skb1->protocol != skb2->protocol) 174 if (skb1->protocol != skb2->protocol)
167 return false; 175 return false;
168 176
169 if (!choke_skb_cb(skb1)->keys_valid) { 177 if (!choke_skb_cb(skb1)->keys_valid) {
170 choke_skb_cb(skb1)->keys_valid = 1; 178 choke_skb_cb(skb1)->keys_valid = 1;
171 skb_flow_dissect(skb1, &choke_skb_cb(skb1)->keys); 179 skb_flow_dissect(skb1, &temp);
180 memcpy(&choke_skb_cb(skb1)->keys, &temp, CHOKE_K_LEN);
172 } 181 }
173 182
174 if (!choke_skb_cb(skb2)->keys_valid) { 183 if (!choke_skb_cb(skb2)->keys_valid) {
175 choke_skb_cb(skb2)->keys_valid = 1; 184 choke_skb_cb(skb2)->keys_valid = 1;
176 skb_flow_dissect(skb2, &choke_skb_cb(skb2)->keys); 185 skb_flow_dissect(skb2, &temp);
186 memcpy(&choke_skb_cb(skb2)->keys, &temp, CHOKE_K_LEN);
177 } 187 }
178 188
179 return !memcmp(&choke_skb_cb(skb1)->keys, 189 return !memcmp(&choke_skb_cb(skb1)->keys,
180 &choke_skb_cb(skb2)->keys, 190 &choke_skb_cb(skb2)->keys,
181 sizeof(struct flow_keys)); 191 CHOKE_K_LEN);
182} 192}
183 193
184/* 194/*
diff --git a/net/socket.c b/net/socket.c
index 2e2586e2dee1..4cdbc107606f 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1996,6 +1996,9 @@ static int copy_msghdr_from_user(struct msghdr *kmsg,
1996 if (copy_from_user(kmsg, umsg, sizeof(struct msghdr))) 1996 if (copy_from_user(kmsg, umsg, sizeof(struct msghdr)))
1997 return -EFAULT; 1997 return -EFAULT;
1998 1998
1999 if (kmsg->msg_name == NULL)
2000 kmsg->msg_namelen = 0;
2001
1999 if (kmsg->msg_namelen < 0) 2002 if (kmsg->msg_namelen < 0)
2000 return -EINVAL; 2003 return -EINVAL;
2001 2004
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index df7b1332a1ec..7257164af91b 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6969,6 +6969,9 @@ void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp)
6969 struct nlattr *data = ((void **)skb->cb)[2]; 6969 struct nlattr *data = ((void **)skb->cb)[2];
6970 enum nl80211_multicast_groups mcgrp = NL80211_MCGRP_TESTMODE; 6970 enum nl80211_multicast_groups mcgrp = NL80211_MCGRP_TESTMODE;
6971 6971
6972 /* clear CB data for netlink core to own from now on */
6973 memset(skb->cb, 0, sizeof(skb->cb));
6974
6972 nla_nest_end(skb, data); 6975 nla_nest_end(skb, data);
6973 genlmsg_end(skb, hdr); 6976 genlmsg_end(skb, hdr);
6974 6977
@@ -9294,6 +9297,9 @@ int cfg80211_vendor_cmd_reply(struct sk_buff *skb)
9294 void *hdr = ((void **)skb->cb)[1]; 9297 void *hdr = ((void **)skb->cb)[1];
9295 struct nlattr *data = ((void **)skb->cb)[2]; 9298 struct nlattr *data = ((void **)skb->cb)[2];
9296 9299
9300 /* clear CB data for netlink core to own from now on */
9301 memset(skb->cb, 0, sizeof(skb->cb));
9302
9297 if (WARN_ON(!rdev->cur_cmd_info)) { 9303 if (WARN_ON(!rdev->cur_cmd_info)) {
9298 kfree_skb(skb); 9304 kfree_skb(skb);
9299 return -EINVAL; 9305 return -EINVAL;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index beeed602aeb3..fdde51f4271a 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -39,6 +39,11 @@
39#define XFRM_QUEUE_TMO_MAX ((unsigned)(60*HZ)) 39#define XFRM_QUEUE_TMO_MAX ((unsigned)(60*HZ))
40#define XFRM_MAX_QUEUE_LEN 100 40#define XFRM_MAX_QUEUE_LEN 100
41 41
42struct xfrm_flo {
43 struct dst_entry *dst_orig;
44 u8 flags;
45};
46
42static DEFINE_SPINLOCK(xfrm_policy_afinfo_lock); 47static DEFINE_SPINLOCK(xfrm_policy_afinfo_lock);
43static struct xfrm_policy_afinfo __rcu *xfrm_policy_afinfo[NPROTO] 48static struct xfrm_policy_afinfo __rcu *xfrm_policy_afinfo[NPROTO]
44 __read_mostly; 49 __read_mostly;
@@ -1877,13 +1882,14 @@ static int xdst_queue_output(struct sock *sk, struct sk_buff *skb)
1877} 1882}
1878 1883
1879static struct xfrm_dst *xfrm_create_dummy_bundle(struct net *net, 1884static struct xfrm_dst *xfrm_create_dummy_bundle(struct net *net,
1880 struct dst_entry *dst, 1885 struct xfrm_flo *xflo,
1881 const struct flowi *fl, 1886 const struct flowi *fl,
1882 int num_xfrms, 1887 int num_xfrms,
1883 u16 family) 1888 u16 family)
1884{ 1889{
1885 int err; 1890 int err;
1886 struct net_device *dev; 1891 struct net_device *dev;
1892 struct dst_entry *dst;
1887 struct dst_entry *dst1; 1893 struct dst_entry *dst1;
1888 struct xfrm_dst *xdst; 1894 struct xfrm_dst *xdst;
1889 1895
@@ -1891,9 +1897,12 @@ static struct xfrm_dst *xfrm_create_dummy_bundle(struct net *net,
1891 if (IS_ERR(xdst)) 1897 if (IS_ERR(xdst))
1892 return xdst; 1898 return xdst;
1893 1899
1894 if (net->xfrm.sysctl_larval_drop || num_xfrms <= 0) 1900 if (!(xflo->flags & XFRM_LOOKUP_QUEUE) ||
1901 net->xfrm.sysctl_larval_drop ||
1902 num_xfrms <= 0)
1895 return xdst; 1903 return xdst;
1896 1904
1905 dst = xflo->dst_orig;
1897 dst1 = &xdst->u.dst; 1906 dst1 = &xdst->u.dst;
1898 dst_hold(dst); 1907 dst_hold(dst);
1899 xdst->route = dst; 1908 xdst->route = dst;
@@ -1935,7 +1944,7 @@ static struct flow_cache_object *
1935xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir, 1944xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir,
1936 struct flow_cache_object *oldflo, void *ctx) 1945 struct flow_cache_object *oldflo, void *ctx)
1937{ 1946{
1938 struct dst_entry *dst_orig = (struct dst_entry *)ctx; 1947 struct xfrm_flo *xflo = (struct xfrm_flo *)ctx;
1939 struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX]; 1948 struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX];
1940 struct xfrm_dst *xdst, *new_xdst; 1949 struct xfrm_dst *xdst, *new_xdst;
1941 int num_pols = 0, num_xfrms = 0, i, err, pol_dead; 1950 int num_pols = 0, num_xfrms = 0, i, err, pol_dead;
@@ -1976,7 +1985,8 @@ xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir,
1976 goto make_dummy_bundle; 1985 goto make_dummy_bundle;
1977 } 1986 }
1978 1987
1979 new_xdst = xfrm_resolve_and_create_bundle(pols, num_pols, fl, family, dst_orig); 1988 new_xdst = xfrm_resolve_and_create_bundle(pols, num_pols, fl, family,
1989 xflo->dst_orig);
1980 if (IS_ERR(new_xdst)) { 1990 if (IS_ERR(new_xdst)) {
1981 err = PTR_ERR(new_xdst); 1991 err = PTR_ERR(new_xdst);
1982 if (err != -EAGAIN) 1992 if (err != -EAGAIN)
@@ -2010,7 +2020,7 @@ make_dummy_bundle:
2010 /* We found policies, but there's no bundles to instantiate: 2020 /* We found policies, but there's no bundles to instantiate:
2011 * either because the policy blocks, has no transformations or 2021 * either because the policy blocks, has no transformations or
2012 * we could not build template (no xfrm_states).*/ 2022 * we could not build template (no xfrm_states).*/
2013 xdst = xfrm_create_dummy_bundle(net, dst_orig, fl, num_xfrms, family); 2023 xdst = xfrm_create_dummy_bundle(net, xflo, fl, num_xfrms, family);
2014 if (IS_ERR(xdst)) { 2024 if (IS_ERR(xdst)) {
2015 xfrm_pols_put(pols, num_pols); 2025 xfrm_pols_put(pols, num_pols);
2016 return ERR_CAST(xdst); 2026 return ERR_CAST(xdst);
@@ -2104,13 +2114,18 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
2104 } 2114 }
2105 2115
2106 if (xdst == NULL) { 2116 if (xdst == NULL) {
2117 struct xfrm_flo xflo;
2118
2119 xflo.dst_orig = dst_orig;
2120 xflo.flags = flags;
2121
2107 /* To accelerate a bit... */ 2122 /* To accelerate a bit... */
2108 if ((dst_orig->flags & DST_NOXFRM) || 2123 if ((dst_orig->flags & DST_NOXFRM) ||
2109 !net->xfrm.policy_count[XFRM_POLICY_OUT]) 2124 !net->xfrm.policy_count[XFRM_POLICY_OUT])
2110 goto nopol; 2125 goto nopol;
2111 2126
2112 flo = flow_cache_lookup(net, fl, family, dir, 2127 flo = flow_cache_lookup(net, fl, family, dir,
2113 xfrm_bundle_lookup, dst_orig); 2128 xfrm_bundle_lookup, &xflo);
2114 if (flo == NULL) 2129 if (flo == NULL)
2115 goto nopol; 2130 goto nopol;
2116 if (IS_ERR(flo)) { 2131 if (IS_ERR(flo)) {
@@ -2138,7 +2153,7 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
2138 xfrm_pols_put(pols, drop_pols); 2153 xfrm_pols_put(pols, drop_pols);
2139 XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES); 2154 XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES);
2140 2155
2141 return make_blackhole(net, family, dst_orig); 2156 return ERR_PTR(-EREMOTE);
2142 } 2157 }
2143 2158
2144 err = -EAGAIN; 2159 err = -EAGAIN;
@@ -2195,6 +2210,23 @@ dropdst:
2195} 2210}
2196EXPORT_SYMBOL(xfrm_lookup); 2211EXPORT_SYMBOL(xfrm_lookup);
2197 2212
2213/* Callers of xfrm_lookup_route() must ensure a call to dst_output().
2214 * Otherwise we may send out blackholed packets.
2215 */
2216struct dst_entry *xfrm_lookup_route(struct net *net, struct dst_entry *dst_orig,
2217 const struct flowi *fl,
2218 struct sock *sk, int flags)
2219{
2220 struct dst_entry *dst = xfrm_lookup(net, dst_orig, fl, sk,
2221 flags | XFRM_LOOKUP_QUEUE);
2222
2223 if (IS_ERR(dst) && PTR_ERR(dst) == -EREMOTE)
2224 return make_blackhole(net, dst_orig->ops->family, dst_orig);
2225
2226 return dst;
2227}
2228EXPORT_SYMBOL(xfrm_lookup_route);
2229
2198static inline int 2230static inline int
2199xfrm_secpath_reject(int idx, struct sk_buff *skb, const struct flowi *fl) 2231xfrm_secpath_reject(int idx, struct sk_buff *skb, const struct flowi *fl)
2200{ 2232{
@@ -2460,7 +2492,7 @@ int __xfrm_route_forward(struct sk_buff *skb, unsigned short family)
2460 2492
2461 skb_dst_force(skb); 2493 skb_dst_force(skb);
2462 2494
2463 dst = xfrm_lookup(net, skb_dst(skb), &fl, NULL, 0); 2495 dst = xfrm_lookup(net, skb_dst(skb), &fl, NULL, XFRM_LOOKUP_QUEUE);
2464 if (IS_ERR(dst)) { 2496 if (IS_ERR(dst)) {
2465 res = 0; 2497 res = 0;
2466 dst = NULL; 2498 dst = NULL;