aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-13 20:27:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-13 20:27:40 -0400
commitf0094b28f3038936c1985be64dbe83f0e950b671 (patch)
treec3a61d5583cc2b39f65ef3b01e6660696b359656 /net
parent13b102bf48d39d84d87bee31544f4588502649b6 (diff)
parent61dac43ee6bedd8507294c7af8959157b686c221 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: "Several networking final fixes and tidies for the merge window: 1) Changes during the merge window unintentionally took away the ability to build bluetooth modular, fix from Geert Uytterhoeven. 2) Several phy_node reference count bug fixes from Uwe Kleine-König. 3) Fix ucc_geth build failures, also from Uwe Kleine-König. 4) Fix klog false positivies when netlink messages go to network taps, by properly resetting the network header. Fix from Daniel Borkmann. 5) Sizing estimate of VF netlink messages is too small, from Jiri Benc. 6) New APM X-Gene SoC ethernet driver, from Iyappan Subramanian. 7) VLAN untagging is erroneously dependent upon whether the VLAN module is loaded or not, but there are generic dependencies that matter wrt what can be expected as the SKB enters the stack. Make the basic untagging generic code, and do it unconditionally. From Vlad Yasevich. 8) xen-netfront only has so many slots in it's transmit queue so linearize packets that have too many frags. From Zoltan Kiss. 9) Fix suspend/resume PHY handling in bcmgenet driver, from Florian Fainelli" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (55 commits) net: bcmgenet: correctly resume adapter from Wake-on-LAN net: bcmgenet: update UMAC_CMD only when link is detected net: bcmgenet: correctly suspend and resume PHY device net: bcmgenet: request and enable main clock earlier net: ethernet: myricom: myri10ge: myri10ge.c: Cleaning up missing null-terminate after strncpy call xen-netfront: Fix handling packets on compound pages with skb_linearize net: fec: Support phys probed from devicetree and fixed-link smsc: replace WARN_ON() with WARN_ON_SMP() xen-netback: Don't deschedule NAPI when carrier off net: ethernet: qlogic: qlcnic: Remove duplicate object file from Makefile wan: wanxl: Remove typedefs from struct names m68k/atari: EtherNEC - ethernet support (ne) net: ethernet: ti: cpmac.c: Cleaning up missing null-terminate after strncpy call hdlc: Remove typedefs from struct names airo_cs: Remove typedef local_info_t atmel: Remove typedef atmel_priv_ioctl com20020_cs: Remove typedef com20020_dev_t ethernet: amd: Remove typedef local_info_t net: Always untag vlan-tagged traffic on input. drivers: net: Add APM X-Gene SoC ethernet driver support. ...
Diffstat (limited to 'net')
-rw-r--r--net/6lowpan/Kconfig2
-rw-r--r--net/8021q/vlan_core.c53
-rw-r--r--net/batman-adv/multicast.c1
-rw-r--r--net/bridge/br_vlan.c2
-rw-r--r--net/bridge/netfilter/ebtables.c10
-rw-r--r--net/core/dev.c2
-rw-r--r--net/core/rtnetlink.c3
-rw-r--r--net/core/skbuff.c53
-rw-r--r--net/ipv4/route.c2
-rw-r--r--net/netfilter/core.c11
-rw-r--r--net/netfilter/ipvs/ip_vs_ctl.c19
-rw-r--r--net/netfilter/nf_sockopt.c8
-rw-r--r--net/netfilter/nf_tables_api.c30
-rw-r--r--net/netfilter/x_tables.c47
-rw-r--r--net/netlink/af_netlink.c2
-rw-r--r--net/openvswitch/datapath.c2
16 files changed, 98 insertions, 149 deletions
diff --git a/net/6lowpan/Kconfig b/net/6lowpan/Kconfig
index 028a5c6d1f61..e4a02ef55102 100644
--- a/net/6lowpan/Kconfig
+++ b/net/6lowpan/Kconfig
@@ -1,5 +1,5 @@
1config 6LOWPAN 1config 6LOWPAN
2 bool "6LoWPAN Support" 2 tristate "6LoWPAN Support"
3 depends on IPV6 3 depends on IPV6
4 ---help--- 4 ---help---
5 This enables IPv6 over Low power Wireless Personal Area Network - 5 This enables IPv6 over Low power Wireless Personal Area Network -
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 75d427763992..90cc2bdd4064 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -112,59 +112,6 @@ __be16 vlan_dev_vlan_proto(const struct net_device *dev)
112} 112}
113EXPORT_SYMBOL(vlan_dev_vlan_proto); 113EXPORT_SYMBOL(vlan_dev_vlan_proto);
114 114
115static struct sk_buff *vlan_reorder_header(struct sk_buff *skb)
116{
117 if (skb_cow(skb, skb_headroom(skb)) < 0) {
118 kfree_skb(skb);
119 return NULL;
120 }
121
122 memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN);
123 skb->mac_header += VLAN_HLEN;
124 return skb;
125}
126
127struct sk_buff *vlan_untag(struct sk_buff *skb)
128{
129 struct vlan_hdr *vhdr;
130 u16 vlan_tci;
131
132 if (unlikely(vlan_tx_tag_present(skb))) {
133 /* vlan_tci is already set-up so leave this for another time */
134 return skb;
135 }
136
137 skb = skb_share_check(skb, GFP_ATOMIC);
138 if (unlikely(!skb))
139 goto err_free;
140
141 if (unlikely(!pskb_may_pull(skb, VLAN_HLEN)))
142 goto err_free;
143
144 vhdr = (struct vlan_hdr *) skb->data;
145 vlan_tci = ntohs(vhdr->h_vlan_TCI);
146 __vlan_hwaccel_put_tag(skb, skb->protocol, vlan_tci);
147
148 skb_pull_rcsum(skb, VLAN_HLEN);
149 vlan_set_encap_proto(skb, vhdr);
150
151 skb = vlan_reorder_header(skb);
152 if (unlikely(!skb))
153 goto err_free;
154
155 skb_reset_network_header(skb);
156 skb_reset_transport_header(skb);
157 skb_reset_mac_len(skb);
158
159 return skb;
160
161err_free:
162 kfree_skb(skb);
163 return NULL;
164}
165EXPORT_SYMBOL(vlan_untag);
166
167
168/* 115/*
169 * vlan info and vid list 116 * vlan info and vid list
170 */ 117 */
diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
index 96b66fd30f96..ab6bb2af1d45 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -20,7 +20,6 @@
20#include "originator.h" 20#include "originator.h"
21#include "hard-interface.h" 21#include "hard-interface.h"
22#include "translation-table.h" 22#include "translation-table.h"
23#include "multicast.h"
24 23
25/** 24/**
26 * batadv_mcast_mla_softif_get - get softif multicast listeners 25 * batadv_mcast_mla_softif_get - get softif multicast listeners
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index febb0f87fa37..e1bcd653899b 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -181,7 +181,7 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v,
181 */ 181 */
182 if (unlikely(!vlan_tx_tag_present(skb) && 182 if (unlikely(!vlan_tx_tag_present(skb) &&
183 skb->protocol == proto)) { 183 skb->protocol == proto)) {
184 skb = vlan_untag(skb); 184 skb = skb_vlan_untag(skb);
185 if (unlikely(!skb)) 185 if (unlikely(!skb))
186 return false; 186 return false;
187 } 187 }
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 1059ed3bc255..6d69631b9f4d 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -327,10 +327,7 @@ find_inlist_lock_noload(struct list_head *head, const char *name, int *error,
327 char name[EBT_FUNCTION_MAXNAMELEN]; 327 char name[EBT_FUNCTION_MAXNAMELEN];
328 } *e; 328 } *e;
329 329
330 *error = mutex_lock_interruptible(mutex); 330 mutex_lock(mutex);
331 if (*error != 0)
332 return NULL;
333
334 list_for_each_entry(e, head, list) { 331 list_for_each_entry(e, head, list) {
335 if (strcmp(e->name, name) == 0) 332 if (strcmp(e->name, name) == 0)
336 return e; 333 return e;
@@ -1203,10 +1200,7 @@ ebt_register_table(struct net *net, const struct ebt_table *input_table)
1203 1200
1204 table->private = newinfo; 1201 table->private = newinfo;
1205 rwlock_init(&table->lock); 1202 rwlock_init(&table->lock);
1206 ret = mutex_lock_interruptible(&ebt_mutex); 1203 mutex_lock(&ebt_mutex);
1207 if (ret != 0)
1208 goto free_chainstack;
1209
1210 list_for_each_entry(t, &net->xt.tables[NFPROTO_BRIDGE], list) { 1204 list_for_each_entry(t, &net->xt.tables[NFPROTO_BRIDGE], list) {
1211 if (strcmp(t->name, table->name) == 0) { 1205 if (strcmp(t->name, table->name) == 0) {
1212 ret = -EEXIST; 1206 ret = -EEXIST;
diff --git a/net/core/dev.c b/net/core/dev.c
index 1c15b189c52b..b65a5051361f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3602,7 +3602,7 @@ another_round:
3602 3602
3603 if (skb->protocol == cpu_to_be16(ETH_P_8021Q) || 3603 if (skb->protocol == cpu_to_be16(ETH_P_8021Q) ||
3604 skb->protocol == cpu_to_be16(ETH_P_8021AD)) { 3604 skb->protocol == cpu_to_be16(ETH_P_8021AD)) {
3605 skb = vlan_untag(skb); 3605 skb = skb_vlan_untag(skb);
3606 if (unlikely(!skb)) 3606 if (unlikely(!skb))
3607 goto unlock; 3607 goto unlock;
3608 } 3608 }
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 8d39071f32d7..f0493e3b7471 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -804,7 +804,8 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev,
804 (nla_total_size(sizeof(struct ifla_vf_mac)) + 804 (nla_total_size(sizeof(struct ifla_vf_mac)) +
805 nla_total_size(sizeof(struct ifla_vf_vlan)) + 805 nla_total_size(sizeof(struct ifla_vf_vlan)) +
806 nla_total_size(sizeof(struct ifla_vf_spoofchk)) + 806 nla_total_size(sizeof(struct ifla_vf_spoofchk)) +
807 nla_total_size(sizeof(struct ifla_vf_rate))); 807 nla_total_size(sizeof(struct ifla_vf_rate)) +
808 nla_total_size(sizeof(struct ifla_vf_link_state)));
808 return size; 809 return size;
809 } else 810 } else
810 return 0; 811 return 0;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 224506a6fa80..163b673f9e62 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -62,6 +62,7 @@
62#include <linux/scatterlist.h> 62#include <linux/scatterlist.h>
63#include <linux/errqueue.h> 63#include <linux/errqueue.h>
64#include <linux/prefetch.h> 64#include <linux/prefetch.h>
65#include <linux/if_vlan.h>
65 66
66#include <net/protocol.h> 67#include <net/protocol.h>
67#include <net/dst.h> 68#include <net/dst.h>
@@ -3973,3 +3974,55 @@ unsigned int skb_gso_transport_seglen(const struct sk_buff *skb)
3973 return shinfo->gso_size; 3974 return shinfo->gso_size;
3974} 3975}
3975EXPORT_SYMBOL_GPL(skb_gso_transport_seglen); 3976EXPORT_SYMBOL_GPL(skb_gso_transport_seglen);
3977
3978static struct sk_buff *skb_reorder_vlan_header(struct sk_buff *skb)
3979{
3980 if (skb_cow(skb, skb_headroom(skb)) < 0) {
3981 kfree_skb(skb);
3982 return NULL;
3983 }
3984
3985 memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN);
3986 skb->mac_header += VLAN_HLEN;
3987 return skb;
3988}
3989
3990struct sk_buff *skb_vlan_untag(struct sk_buff *skb)
3991{
3992 struct vlan_hdr *vhdr;
3993 u16 vlan_tci;
3994
3995 if (unlikely(vlan_tx_tag_present(skb))) {
3996 /* vlan_tci is already set-up so leave this for another time */
3997 return skb;
3998 }
3999
4000 skb = skb_share_check(skb, GFP_ATOMIC);
4001 if (unlikely(!skb))
4002 goto err_free;
4003
4004 if (unlikely(!pskb_may_pull(skb, VLAN_HLEN)))
4005 goto err_free;
4006
4007 vhdr = (struct vlan_hdr *)skb->data;
4008 vlan_tci = ntohs(vhdr->h_vlan_TCI);
4009 __vlan_hwaccel_put_tag(skb, skb->protocol, vlan_tci);
4010
4011 skb_pull_rcsum(skb, VLAN_HLEN);
4012 vlan_set_encap_proto(skb, vhdr);
4013
4014 skb = skb_reorder_vlan_header(skb);
4015 if (unlikely(!skb))
4016 goto err_free;
4017
4018 skb_reset_network_header(skb);
4019 skb_reset_transport_header(skb);
4020 skb_reset_mac_len(skb);
4021
4022 return skb;
4023
4024err_free:
4025 kfree_skb(skb);
4026 return NULL;
4027}
4028EXPORT_SYMBOL(skb_vlan_untag);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 190199851c9a..eaa4b000c7b4 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1798,8 +1798,6 @@ local_input:
1798no_route: 1798no_route:
1799 RT_CACHE_STAT_INC(in_no_route); 1799 RT_CACHE_STAT_INC(in_no_route);
1800 res.type = RTN_UNREACHABLE; 1800 res.type = RTN_UNREACHABLE;
1801 if (err == -ESRCH)
1802 err = -ENETUNREACH;
1803 goto local_input; 1801 goto local_input;
1804 1802
1805 /* 1803 /*
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 1fbab0cdd302..a93c97f106d4 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -35,11 +35,7 @@ EXPORT_SYMBOL_GPL(nf_ipv6_ops);
35 35
36int nf_register_afinfo(const struct nf_afinfo *afinfo) 36int nf_register_afinfo(const struct nf_afinfo *afinfo)
37{ 37{
38 int err; 38 mutex_lock(&afinfo_mutex);
39
40 err = mutex_lock_interruptible(&afinfo_mutex);
41 if (err < 0)
42 return err;
43 RCU_INIT_POINTER(nf_afinfo[afinfo->family], afinfo); 39 RCU_INIT_POINTER(nf_afinfo[afinfo->family], afinfo);
44 mutex_unlock(&afinfo_mutex); 40 mutex_unlock(&afinfo_mutex);
45 return 0; 41 return 0;
@@ -68,11 +64,8 @@ static DEFINE_MUTEX(nf_hook_mutex);
68int nf_register_hook(struct nf_hook_ops *reg) 64int nf_register_hook(struct nf_hook_ops *reg)
69{ 65{
70 struct nf_hook_ops *elem; 66 struct nf_hook_ops *elem;
71 int err;
72 67
73 err = mutex_lock_interruptible(&nf_hook_mutex); 68 mutex_lock(&nf_hook_mutex);
74 if (err < 0)
75 return err;
76 list_for_each_entry(elem, &nf_hooks[reg->pf][reg->hooknum], list) { 69 list_for_each_entry(elem, &nf_hooks[reg->pf][reg->hooknum], list) {
77 if (reg->priority < elem->priority) 70 if (reg->priority < elem->priority)
78 break; 71 break;
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 8416307fdd1d..fd3f444a4f96 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -2271,10 +2271,7 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
2271 cmd == IP_VS_SO_SET_STOPDAEMON) { 2271 cmd == IP_VS_SO_SET_STOPDAEMON) {
2272 struct ip_vs_daemon_user *dm = (struct ip_vs_daemon_user *)arg; 2272 struct ip_vs_daemon_user *dm = (struct ip_vs_daemon_user *)arg;
2273 2273
2274 if (mutex_lock_interruptible(&ipvs->sync_mutex)) { 2274 mutex_lock(&ipvs->sync_mutex);
2275 ret = -ERESTARTSYS;
2276 goto out_dec;
2277 }
2278 if (cmd == IP_VS_SO_SET_STARTDAEMON) 2275 if (cmd == IP_VS_SO_SET_STARTDAEMON)
2279 ret = start_sync_thread(net, dm->state, dm->mcast_ifn, 2276 ret = start_sync_thread(net, dm->state, dm->mcast_ifn,
2280 dm->syncid); 2277 dm->syncid);
@@ -2284,11 +2281,7 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
2284 goto out_dec; 2281 goto out_dec;
2285 } 2282 }
2286 2283
2287 if (mutex_lock_interruptible(&__ip_vs_mutex)) { 2284 mutex_lock(&__ip_vs_mutex);
2288 ret = -ERESTARTSYS;
2289 goto out_dec;
2290 }
2291
2292 if (cmd == IP_VS_SO_SET_FLUSH) { 2285 if (cmd == IP_VS_SO_SET_FLUSH) {
2293 /* Flush the virtual service */ 2286 /* Flush the virtual service */
2294 ret = ip_vs_flush(net, false); 2287 ret = ip_vs_flush(net, false);
@@ -2573,9 +2566,7 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
2573 struct ip_vs_daemon_user d[2]; 2566 struct ip_vs_daemon_user d[2];
2574 2567
2575 memset(&d, 0, sizeof(d)); 2568 memset(&d, 0, sizeof(d));
2576 if (mutex_lock_interruptible(&ipvs->sync_mutex)) 2569 mutex_lock(&ipvs->sync_mutex);
2577 return -ERESTARTSYS;
2578
2579 if (ipvs->sync_state & IP_VS_STATE_MASTER) { 2570 if (ipvs->sync_state & IP_VS_STATE_MASTER) {
2580 d[0].state = IP_VS_STATE_MASTER; 2571 d[0].state = IP_VS_STATE_MASTER;
2581 strlcpy(d[0].mcast_ifn, ipvs->master_mcast_ifn, 2572 strlcpy(d[0].mcast_ifn, ipvs->master_mcast_ifn,
@@ -2594,9 +2585,7 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
2594 return ret; 2585 return ret;
2595 } 2586 }
2596 2587
2597 if (mutex_lock_interruptible(&__ip_vs_mutex)) 2588 mutex_lock(&__ip_vs_mutex);
2598 return -ERESTARTSYS;
2599
2600 switch (cmd) { 2589 switch (cmd) {
2601 case IP_VS_SO_GET_VERSION: 2590 case IP_VS_SO_GET_VERSION:
2602 { 2591 {
diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c
index f042ae521557..c68c1e58b362 100644
--- a/net/netfilter/nf_sockopt.c
+++ b/net/netfilter/nf_sockopt.c
@@ -26,9 +26,7 @@ int nf_register_sockopt(struct nf_sockopt_ops *reg)
26 struct nf_sockopt_ops *ops; 26 struct nf_sockopt_ops *ops;
27 int ret = 0; 27 int ret = 0;
28 28
29 if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) 29 mutex_lock(&nf_sockopt_mutex);
30 return -EINTR;
31
32 list_for_each_entry(ops, &nf_sockopts, list) { 30 list_for_each_entry(ops, &nf_sockopts, list) {
33 if (ops->pf == reg->pf 31 if (ops->pf == reg->pf
34 && (overlap(ops->set_optmin, ops->set_optmax, 32 && (overlap(ops->set_optmin, ops->set_optmax,
@@ -65,9 +63,7 @@ static struct nf_sockopt_ops *nf_sockopt_find(struct sock *sk, u_int8_t pf,
65{ 63{
66 struct nf_sockopt_ops *ops; 64 struct nf_sockopt_ops *ops;
67 65
68 if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) 66 mutex_lock(&nf_sockopt_mutex);
69 return ERR_PTR(-EINTR);
70
71 list_for_each_entry(ops, &nf_sockopts, list) { 67 list_for_each_entry(ops, &nf_sockopts, list) {
72 if (ops->pf == pf) { 68 if (ops->pf == pf) {
73 if (!try_module_get(ops->owner)) 69 if (!try_module_get(ops->owner))
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index b8035c2d6667..deeb95fb7028 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -899,6 +899,9 @@ static struct nft_stats __percpu *nft_stats_alloc(const struct nlattr *attr)
899static void nft_chain_stats_replace(struct nft_base_chain *chain, 899static void nft_chain_stats_replace(struct nft_base_chain *chain,
900 struct nft_stats __percpu *newstats) 900 struct nft_stats __percpu *newstats)
901{ 901{
902 if (newstats == NULL)
903 return;
904
902 if (chain->stats) { 905 if (chain->stats) {
903 struct nft_stats __percpu *oldstats = 906 struct nft_stats __percpu *oldstats =
904 nft_dereference(chain->stats); 907 nft_dereference(chain->stats);
@@ -3134,16 +3137,13 @@ static int nft_del_setelem(struct nft_ctx *ctx, struct nft_set *set,
3134 goto err2; 3137 goto err2;
3135 3138
3136 trans = nft_trans_elem_alloc(ctx, NFT_MSG_DELSETELEM, set); 3139 trans = nft_trans_elem_alloc(ctx, NFT_MSG_DELSETELEM, set);
3137 if (trans == NULL) 3140 if (trans == NULL) {
3141 err = -ENOMEM;
3138 goto err2; 3142 goto err2;
3143 }
3139 3144
3140 nft_trans_elem(trans) = elem; 3145 nft_trans_elem(trans) = elem;
3141 list_add_tail(&trans->list, &ctx->net->nft.commit_list); 3146 list_add_tail(&trans->list, &ctx->net->nft.commit_list);
3142
3143 nft_data_uninit(&elem.key, NFT_DATA_VALUE);
3144 if (set->flags & NFT_SET_MAP)
3145 nft_data_uninit(&elem.data, set->dtype);
3146
3147 return 0; 3147 return 0;
3148err2: 3148err2:
3149 nft_data_uninit(&elem.key, desc.type); 3149 nft_data_uninit(&elem.key, desc.type);
@@ -3310,7 +3310,7 @@ static int nf_tables_commit(struct sk_buff *skb)
3310{ 3310{
3311 struct net *net = sock_net(skb->sk); 3311 struct net *net = sock_net(skb->sk);
3312 struct nft_trans *trans, *next; 3312 struct nft_trans *trans, *next;
3313 struct nft_set *set; 3313 struct nft_trans_elem *te;
3314 3314
3315 /* Bump generation counter, invalidate any dump in progress */ 3315 /* Bump generation counter, invalidate any dump in progress */
3316 while (++net->nft.base_seq == 0); 3316 while (++net->nft.base_seq == 0);
@@ -3396,13 +3396,17 @@ static int nf_tables_commit(struct sk_buff *skb)
3396 nft_trans_destroy(trans); 3396 nft_trans_destroy(trans);
3397 break; 3397 break;
3398 case NFT_MSG_DELSETELEM: 3398 case NFT_MSG_DELSETELEM:
3399 nf_tables_setelem_notify(&trans->ctx, 3399 te = (struct nft_trans_elem *)trans->data;
3400 nft_trans_elem_set(trans), 3400 nf_tables_setelem_notify(&trans->ctx, te->set,
3401 &nft_trans_elem(trans), 3401 &te->elem,
3402 NFT_MSG_DELSETELEM, 0); 3402 NFT_MSG_DELSETELEM, 0);
3403 set = nft_trans_elem_set(trans); 3403 te->set->ops->get(te->set, &te->elem);
3404 set->ops->get(set, &nft_trans_elem(trans)); 3404 te->set->ops->remove(te->set, &te->elem);
3405 set->ops->remove(set, &nft_trans_elem(trans)); 3405 nft_data_uninit(&te->elem.key, NFT_DATA_VALUE);
3406 if (te->elem.flags & NFT_SET_MAP) {
3407 nft_data_uninit(&te->elem.data,
3408 te->set->dtype);
3409 }
3406 nft_trans_destroy(trans); 3410 nft_trans_destroy(trans);
3407 break; 3411 break;
3408 } 3412 }
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 47b978bc3100..272ae4d6fdf4 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -71,18 +71,14 @@ static const char *const xt_prefix[NFPROTO_NUMPROTO] = {
71static const unsigned int xt_jumpstack_multiplier = 2; 71static const unsigned int xt_jumpstack_multiplier = 2;
72 72
73/* Registration hooks for targets. */ 73/* Registration hooks for targets. */
74int 74int xt_register_target(struct xt_target *target)
75xt_register_target(struct xt_target *target)
76{ 75{
77 u_int8_t af = target->family; 76 u_int8_t af = target->family;
78 int ret;
79 77
80 ret = mutex_lock_interruptible(&xt[af].mutex); 78 mutex_lock(&xt[af].mutex);
81 if (ret != 0)
82 return ret;
83 list_add(&target->list, &xt[af].target); 79 list_add(&target->list, &xt[af].target);
84 mutex_unlock(&xt[af].mutex); 80 mutex_unlock(&xt[af].mutex);
85 return ret; 81 return 0;
86} 82}
87EXPORT_SYMBOL(xt_register_target); 83EXPORT_SYMBOL(xt_register_target);
88 84
@@ -125,20 +121,14 @@ xt_unregister_targets(struct xt_target *target, unsigned int n)
125} 121}
126EXPORT_SYMBOL(xt_unregister_targets); 122EXPORT_SYMBOL(xt_unregister_targets);
127 123
128int 124int xt_register_match(struct xt_match *match)
129xt_register_match(struct xt_match *match)
130{ 125{
131 u_int8_t af = match->family; 126 u_int8_t af = match->family;
132 int ret;
133
134 ret = mutex_lock_interruptible(&xt[af].mutex);
135 if (ret != 0)
136 return ret;
137 127
128 mutex_lock(&xt[af].mutex);
138 list_add(&match->list, &xt[af].match); 129 list_add(&match->list, &xt[af].match);
139 mutex_unlock(&xt[af].mutex); 130 mutex_unlock(&xt[af].mutex);
140 131 return 0;
141 return ret;
142} 132}
143EXPORT_SYMBOL(xt_register_match); 133EXPORT_SYMBOL(xt_register_match);
144 134
@@ -194,9 +184,7 @@ struct xt_match *xt_find_match(u8 af, const char *name, u8 revision)
194 struct xt_match *m; 184 struct xt_match *m;
195 int err = -ENOENT; 185 int err = -ENOENT;
196 186
197 if (mutex_lock_interruptible(&xt[af].mutex) != 0) 187 mutex_lock(&xt[af].mutex);
198 return ERR_PTR(-EINTR);
199
200 list_for_each_entry(m, &xt[af].match, list) { 188 list_for_each_entry(m, &xt[af].match, list) {
201 if (strcmp(m->name, name) == 0) { 189 if (strcmp(m->name, name) == 0) {
202 if (m->revision == revision) { 190 if (m->revision == revision) {
@@ -239,9 +227,7 @@ struct xt_target *xt_find_target(u8 af, const char *name, u8 revision)
239 struct xt_target *t; 227 struct xt_target *t;
240 int err = -ENOENT; 228 int err = -ENOENT;
241 229
242 if (mutex_lock_interruptible(&xt[af].mutex) != 0) 230 mutex_lock(&xt[af].mutex);
243 return ERR_PTR(-EINTR);
244
245 list_for_each_entry(t, &xt[af].target, list) { 231 list_for_each_entry(t, &xt[af].target, list) {
246 if (strcmp(t->name, name) == 0) { 232 if (strcmp(t->name, name) == 0) {
247 if (t->revision == revision) { 233 if (t->revision == revision) {
@@ -323,10 +309,7 @@ int xt_find_revision(u8 af, const char *name, u8 revision, int target,
323{ 309{
324 int have_rev, best = -1; 310 int have_rev, best = -1;
325 311
326 if (mutex_lock_interruptible(&xt[af].mutex) != 0) { 312 mutex_lock(&xt[af].mutex);
327 *err = -EINTR;
328 return 1;
329 }
330 if (target == 1) 313 if (target == 1)
331 have_rev = target_revfn(af, name, revision, &best); 314 have_rev = target_revfn(af, name, revision, &best);
332 else 315 else
@@ -732,9 +715,7 @@ struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af,
732{ 715{
733 struct xt_table *t; 716 struct xt_table *t;
734 717
735 if (mutex_lock_interruptible(&xt[af].mutex) != 0) 718 mutex_lock(&xt[af].mutex);
736 return ERR_PTR(-EINTR);
737
738 list_for_each_entry(t, &net->xt.tables[af], list) 719 list_for_each_entry(t, &net->xt.tables[af], list)
739 if (strcmp(t->name, name) == 0 && try_module_get(t->me)) 720 if (strcmp(t->name, name) == 0 && try_module_get(t->me))
740 return t; 721 return t;
@@ -883,10 +864,7 @@ struct xt_table *xt_register_table(struct net *net,
883 goto out; 864 goto out;
884 } 865 }
885 866
886 ret = mutex_lock_interruptible(&xt[table->af].mutex); 867 mutex_lock(&xt[table->af].mutex);
887 if (ret != 0)
888 goto out_free;
889
890 /* Don't autoload: we'd eat our tail... */ 868 /* Don't autoload: we'd eat our tail... */
891 list_for_each_entry(t, &net->xt.tables[table->af], list) { 869 list_for_each_entry(t, &net->xt.tables[table->af], list) {
892 if (strcmp(t->name, table->name) == 0) { 870 if (strcmp(t->name, table->name) == 0) {
@@ -911,9 +889,8 @@ struct xt_table *xt_register_table(struct net *net,
911 mutex_unlock(&xt[table->af].mutex); 889 mutex_unlock(&xt[table->af].mutex);
912 return table; 890 return table;
913 891
914 unlock: 892unlock:
915 mutex_unlock(&xt[table->af].mutex); 893 mutex_unlock(&xt[table->af].mutex);
916out_free:
917 kfree(table); 894 kfree(table);
918out: 895out:
919 return ERR_PTR(ret); 896 return ERR_PTR(ret);
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index a324b4b34c90..2e152e5f2186 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -213,7 +213,7 @@ static int __netlink_deliver_tap_skb(struct sk_buff *skb,
213 nskb->protocol = htons((u16) sk->sk_protocol); 213 nskb->protocol = htons((u16) sk->sk_protocol);
214 nskb->pkt_type = netlink_is_kernel(sk) ? 214 nskb->pkt_type = netlink_is_kernel(sk) ?
215 PACKET_KERNEL : PACKET_USER; 215 PACKET_KERNEL : PACKET_USER;
216 216 skb_reset_network_header(nskb);
217 ret = dev_queue_xmit(nskb); 217 ret = dev_queue_xmit(nskb);
218 if (unlikely(ret > 0)) 218 if (unlikely(ret > 0))
219 ret = net_xmit_errno(ret); 219 ret = net_xmit_errno(ret);
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 7ad3f029baae..7228ec3faf19 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -47,8 +47,6 @@
47#include <linux/openvswitch.h> 47#include <linux/openvswitch.h>
48#include <linux/rculist.h> 48#include <linux/rculist.h>
49#include <linux/dmi.h> 49#include <linux/dmi.h>
50#include <linux/genetlink.h>
51#include <net/genetlink.h>
52#include <net/genetlink.h> 50#include <net/genetlink.h>
53#include <net/net_namespace.h> 51#include <net/net_namespace.h>
54#include <net/netns/generic.h> 52#include <net/netns/generic.h>