diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-02 13:15:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-02 13:15:52 -0500 |
commit | 391e572cd1a63aee9c8d4c2d5e3dada91d86bc43 (patch) | |
tree | b89d924e644a7e66cd2b63d978607c6d0d3e7285 /net | |
parent | 4ac96572f1f6abe44b5e02e80fdfb5a990129613 (diff) | |
parent | 48dcc33e5e11de0f76b65b113988dbc930d17395 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (33 commits)
af_unix: netns: fix problem of return value
IRDA: remove double inclusion of module.h
udp: multicast packets need to check namespace
net: add documentation for skb recycling
key: fix setkey(8) policy set breakage
bpa10x: free sk_buff with kfree_skb
xfrm: do not leak ESRCH to user space
net: Really remove all of LOOPBACK_TSO code.
netfilter: nf_conntrack_proto_gre: switch to register_pernet_gen_subsys()
netns: add register_pernet_gen_subsys/unregister_pernet_gen_subsys
net: delete excess kernel-doc notation
pppoe: Fix socket leak.
gianfar: Don't reset TBI<->SerDes link if it's already up
gianfar: Fix race in TBI/SerDes configuration
at91_ether: request/free GPIO for PHY interrupt
amd8111e: fix dma_free_coherent context
atl1: fix vlan tag regression
SMC91x: delete unused local variable "lp"
myri10ge: fix stop/go mmio ordering
bonding: fix panic when taking bond interface down before removing module
...
Diffstat (limited to 'net')
-rw-r--r-- | net/core/net_namespace.c | 32 | ||||
-rw-r--r-- | net/core/skbuff.c | 12 | ||||
-rw-r--r-- | net/ipv4/cipso_ipv4.c | 7 | ||||
-rw-r--r-- | net/ipv4/udp.c | 12 | ||||
-rw-r--r-- | net/ipv6/udp.c | 8 | ||||
-rw-r--r-- | net/key/af_key.c | 1 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_gre.c | 4 | ||||
-rw-r--r-- | net/netlabel/netlabel_addrlist.c | 2 | ||||
-rw-r--r-- | net/netlabel/netlabel_addrlist.h | 22 | ||||
-rw-r--r-- | net/netlabel/netlabel_mgmt.c | 2 | ||||
-rw-r--r-- | net/unix/af_unix.c | 2 | ||||
-rw-r--r-- | net/xfrm/xfrm_policy.c | 2 |
12 files changed, 89 insertions, 17 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index f1d07b5c1e17..1895a4ca9c4f 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -325,6 +325,38 @@ void unregister_pernet_subsys(struct pernet_operations *module) | |||
325 | } | 325 | } |
326 | EXPORT_SYMBOL_GPL(unregister_pernet_subsys); | 326 | EXPORT_SYMBOL_GPL(unregister_pernet_subsys); |
327 | 327 | ||
328 | int register_pernet_gen_subsys(int *id, struct pernet_operations *ops) | ||
329 | { | ||
330 | int rv; | ||
331 | |||
332 | mutex_lock(&net_mutex); | ||
333 | again: | ||
334 | rv = ida_get_new_above(&net_generic_ids, 1, id); | ||
335 | if (rv < 0) { | ||
336 | if (rv == -EAGAIN) { | ||
337 | ida_pre_get(&net_generic_ids, GFP_KERNEL); | ||
338 | goto again; | ||
339 | } | ||
340 | goto out; | ||
341 | } | ||
342 | rv = register_pernet_operations(first_device, ops); | ||
343 | if (rv < 0) | ||
344 | ida_remove(&net_generic_ids, *id); | ||
345 | mutex_unlock(&net_mutex); | ||
346 | out: | ||
347 | return rv; | ||
348 | } | ||
349 | EXPORT_SYMBOL_GPL(register_pernet_gen_subsys); | ||
350 | |||
351 | void unregister_pernet_gen_subsys(int id, struct pernet_operations *ops) | ||
352 | { | ||
353 | mutex_lock(&net_mutex); | ||
354 | unregister_pernet_operations(ops); | ||
355 | ida_remove(&net_generic_ids, id); | ||
356 | mutex_unlock(&net_mutex); | ||
357 | } | ||
358 | EXPORT_SYMBOL_GPL(unregister_pernet_gen_subsys); | ||
359 | |||
328 | /** | 360 | /** |
329 | * register_pernet_device - register a network namespace device | 361 | * register_pernet_device - register a network namespace device |
330 | * @ops: pernet operations structure for the subsystem | 362 | * @ops: pernet operations structure for the subsystem |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 4e22e3a35359..ebb6b94f8af2 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -449,6 +449,18 @@ void kfree_skb(struct sk_buff *skb) | |||
449 | __kfree_skb(skb); | 449 | __kfree_skb(skb); |
450 | } | 450 | } |
451 | 451 | ||
452 | /** | ||
453 | * skb_recycle_check - check if skb can be reused for receive | ||
454 | * @skb: buffer | ||
455 | * @skb_size: minimum receive buffer size | ||
456 | * | ||
457 | * Checks that the skb passed in is not shared or cloned, and | ||
458 | * that it is linear and its head portion at least as large as | ||
459 | * skb_size so that it can be recycled as a receive buffer. | ||
460 | * If these conditions are met, this function does any necessary | ||
461 | * reference count dropping and cleans up the skbuff as if it | ||
462 | * just came from __alloc_skb(). | ||
463 | */ | ||
452 | int skb_recycle_check(struct sk_buff *skb, int skb_size) | 464 | int skb_recycle_check(struct sk_buff *skb, int skb_size) |
453 | { | 465 | { |
454 | struct skb_shared_info *shinfo; | 466 | struct skb_shared_info *shinfo; |
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c index 490e035c6d90..2e78f6bd9775 100644 --- a/net/ipv4/cipso_ipv4.c +++ b/net/ipv4/cipso_ipv4.c | |||
@@ -2063,9 +2063,10 @@ int cipso_v4_skbuff_setattr(struct sk_buff *skb, | |||
2063 | u32 opt_len; | 2063 | u32 opt_len; |
2064 | int len_delta; | 2064 | int len_delta; |
2065 | 2065 | ||
2066 | buf_len = cipso_v4_genopt(buf, buf_len, doi_def, secattr); | 2066 | ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); |
2067 | if (buf_len < 0) | 2067 | if (ret_val < 0) |
2068 | return buf_len; | 2068 | return ret_val; |
2069 | buf_len = ret_val; | ||
2069 | opt_len = (buf_len + 3) & ~3; | 2070 | opt_len = (buf_len + 3) & ~3; |
2070 | 2071 | ||
2071 | /* we overwrite any existing options to ensure that we have enough | 2072 | /* we overwrite any existing options to ensure that we have enough |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 2095abc3caba..cf02701ced48 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -284,7 +284,7 @@ struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, | |||
284 | } | 284 | } |
285 | EXPORT_SYMBOL_GPL(udp4_lib_lookup); | 285 | EXPORT_SYMBOL_GPL(udp4_lib_lookup); |
286 | 286 | ||
287 | static inline struct sock *udp_v4_mcast_next(struct sock *sk, | 287 | static inline struct sock *udp_v4_mcast_next(struct net *net, struct sock *sk, |
288 | __be16 loc_port, __be32 loc_addr, | 288 | __be16 loc_port, __be32 loc_addr, |
289 | __be16 rmt_port, __be32 rmt_addr, | 289 | __be16 rmt_port, __be32 rmt_addr, |
290 | int dif) | 290 | int dif) |
@@ -296,7 +296,8 @@ static inline struct sock *udp_v4_mcast_next(struct sock *sk, | |||
296 | sk_for_each_from(s, node) { | 296 | sk_for_each_from(s, node) { |
297 | struct inet_sock *inet = inet_sk(s); | 297 | struct inet_sock *inet = inet_sk(s); |
298 | 298 | ||
299 | if (s->sk_hash != hnum || | 299 | if (!net_eq(sock_net(s), net) || |
300 | s->sk_hash != hnum || | ||
300 | (inet->daddr && inet->daddr != rmt_addr) || | 301 | (inet->daddr && inet->daddr != rmt_addr) || |
301 | (inet->dport != rmt_port && inet->dport) || | 302 | (inet->dport != rmt_port && inet->dport) || |
302 | (inet->rcv_saddr && inet->rcv_saddr != loc_addr) || | 303 | (inet->rcv_saddr && inet->rcv_saddr != loc_addr) || |
@@ -1079,15 +1080,16 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb, | |||
1079 | read_lock(&udp_hash_lock); | 1080 | read_lock(&udp_hash_lock); |
1080 | sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]); | 1081 | sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]); |
1081 | dif = skb->dev->ifindex; | 1082 | dif = skb->dev->ifindex; |
1082 | sk = udp_v4_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif); | 1083 | sk = udp_v4_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif); |
1083 | if (sk) { | 1084 | if (sk) { |
1084 | struct sock *sknext = NULL; | 1085 | struct sock *sknext = NULL; |
1085 | 1086 | ||
1086 | do { | 1087 | do { |
1087 | struct sk_buff *skb1 = skb; | 1088 | struct sk_buff *skb1 = skb; |
1088 | 1089 | ||
1089 | sknext = udp_v4_mcast_next(sk_next(sk), uh->dest, daddr, | 1090 | sknext = udp_v4_mcast_next(net, sk_next(sk), uh->dest, |
1090 | uh->source, saddr, dif); | 1091 | daddr, uh->source, saddr, |
1092 | dif); | ||
1091 | if (sknext) | 1093 | if (sknext) |
1092 | skb1 = skb_clone(skb, GFP_ATOMIC); | 1094 | skb1 = skb_clone(skb, GFP_ATOMIC); |
1093 | 1095 | ||
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index e51da8c092fa..71e259e866a1 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -328,7 +328,7 @@ drop: | |||
328 | return -1; | 328 | return -1; |
329 | } | 329 | } |
330 | 330 | ||
331 | static struct sock *udp_v6_mcast_next(struct sock *sk, | 331 | static struct sock *udp_v6_mcast_next(struct net *net, struct sock *sk, |
332 | __be16 loc_port, struct in6_addr *loc_addr, | 332 | __be16 loc_port, struct in6_addr *loc_addr, |
333 | __be16 rmt_port, struct in6_addr *rmt_addr, | 333 | __be16 rmt_port, struct in6_addr *rmt_addr, |
334 | int dif) | 334 | int dif) |
@@ -340,7 +340,7 @@ static struct sock *udp_v6_mcast_next(struct sock *sk, | |||
340 | sk_for_each_from(s, node) { | 340 | sk_for_each_from(s, node) { |
341 | struct inet_sock *inet = inet_sk(s); | 341 | struct inet_sock *inet = inet_sk(s); |
342 | 342 | ||
343 | if (sock_net(s) != sock_net(sk)) | 343 | if (!net_eq(sock_net(s), net)) |
344 | continue; | 344 | continue; |
345 | 345 | ||
346 | if (s->sk_hash == num && s->sk_family == PF_INET6) { | 346 | if (s->sk_hash == num && s->sk_family == PF_INET6) { |
@@ -383,14 +383,14 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb, | |||
383 | read_lock(&udp_hash_lock); | 383 | read_lock(&udp_hash_lock); |
384 | sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]); | 384 | sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]); |
385 | dif = inet6_iif(skb); | 385 | dif = inet6_iif(skb); |
386 | sk = udp_v6_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif); | 386 | sk = udp_v6_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif); |
387 | if (!sk) { | 387 | if (!sk) { |
388 | kfree_skb(skb); | 388 | kfree_skb(skb); |
389 | goto out; | 389 | goto out; |
390 | } | 390 | } |
391 | 391 | ||
392 | sk2 = sk; | 392 | sk2 = sk; |
393 | while ((sk2 = udp_v6_mcast_next(sk_next(sk2), uh->dest, daddr, | 393 | while ((sk2 = udp_v6_mcast_next(net, sk_next(sk2), uh->dest, daddr, |
394 | uh->source, saddr, dif))) { | 394 | uh->source, saddr, dif))) { |
395 | struct sk_buff *buff = skb_clone(skb, GFP_ATOMIC); | 395 | struct sk_buff *buff = skb_clone(skb, GFP_ATOMIC); |
396 | if (buff) { | 396 | if (buff) { |
diff --git a/net/key/af_key.c b/net/key/af_key.c index e55e0441e4d9..3440a4637f01 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -2075,7 +2075,6 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, in | |||
2075 | req_size += socklen * 2; | 2075 | req_size += socklen * 2; |
2076 | } else { | 2076 | } else { |
2077 | size -= 2*socklen; | 2077 | size -= 2*socklen; |
2078 | socklen = 0; | ||
2079 | } | 2078 | } |
2080 | rq = (void*)skb_put(skb, req_size); | 2079 | rq = (void*)skb_put(skb, req_size); |
2081 | pol->sadb_x_policy_len += req_size/8; | 2080 | pol->sadb_x_policy_len += req_size/8; |
diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c index a2cdbcbf64c4..4ab62ad85dd4 100644 --- a/net/netfilter/nf_conntrack_proto_gre.c +++ b/net/netfilter/nf_conntrack_proto_gre.c | |||
@@ -335,7 +335,7 @@ static int __init nf_ct_proto_gre_init(void) | |||
335 | rv = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_gre4); | 335 | rv = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_gre4); |
336 | if (rv < 0) | 336 | if (rv < 0) |
337 | return rv; | 337 | return rv; |
338 | rv = register_pernet_gen_device(&proto_gre_net_id, &proto_gre_net_ops); | 338 | rv = register_pernet_gen_subsys(&proto_gre_net_id, &proto_gre_net_ops); |
339 | if (rv < 0) | 339 | if (rv < 0) |
340 | nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_gre4); | 340 | nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_gre4); |
341 | return rv; | 341 | return rv; |
@@ -344,7 +344,7 @@ static int __init nf_ct_proto_gre_init(void) | |||
344 | static void nf_ct_proto_gre_fini(void) | 344 | static void nf_ct_proto_gre_fini(void) |
345 | { | 345 | { |
346 | nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_gre4); | 346 | nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_gre4); |
347 | unregister_pernet_gen_device(proto_gre_net_id, &proto_gre_net_ops); | 347 | unregister_pernet_gen_subsys(proto_gre_net_id, &proto_gre_net_ops); |
348 | } | 348 | } |
349 | 349 | ||
350 | module_init(nf_ct_proto_gre_init); | 350 | module_init(nf_ct_proto_gre_init); |
diff --git a/net/netlabel/netlabel_addrlist.c b/net/netlabel/netlabel_addrlist.c index b0925a303353..249f6b92f153 100644 --- a/net/netlabel/netlabel_addrlist.c +++ b/net/netlabel/netlabel_addrlist.c | |||
@@ -315,6 +315,7 @@ struct netlbl_af6list *netlbl_af6list_remove(const struct in6_addr *addr, | |||
315 | * Audit Helper Functions | 315 | * Audit Helper Functions |
316 | */ | 316 | */ |
317 | 317 | ||
318 | #ifdef CONFIG_AUDIT | ||
318 | /** | 319 | /** |
319 | * netlbl_af4list_audit_addr - Audit an IPv4 address | 320 | * netlbl_af4list_audit_addr - Audit an IPv4 address |
320 | * @audit_buf: audit buffer | 321 | * @audit_buf: audit buffer |
@@ -386,3 +387,4 @@ void netlbl_af6list_audit_addr(struct audit_buffer *audit_buf, | |||
386 | } | 387 | } |
387 | } | 388 | } |
388 | #endif /* IPv6 */ | 389 | #endif /* IPv6 */ |
390 | #endif /* CONFIG_AUDIT */ | ||
diff --git a/net/netlabel/netlabel_addrlist.h b/net/netlabel/netlabel_addrlist.h index 0242bead405f..07ae7fd82be1 100644 --- a/net/netlabel/netlabel_addrlist.h +++ b/net/netlabel/netlabel_addrlist.h | |||
@@ -120,9 +120,19 @@ struct netlbl_af4list *netlbl_af4list_search(__be32 addr, | |||
120 | struct netlbl_af4list *netlbl_af4list_search_exact(__be32 addr, | 120 | struct netlbl_af4list *netlbl_af4list_search_exact(__be32 addr, |
121 | __be32 mask, | 121 | __be32 mask, |
122 | struct list_head *head); | 122 | struct list_head *head); |
123 | |||
124 | #ifdef CONFIG_AUDIT | ||
123 | void netlbl_af4list_audit_addr(struct audit_buffer *audit_buf, | 125 | void netlbl_af4list_audit_addr(struct audit_buffer *audit_buf, |
124 | int src, const char *dev, | 126 | int src, const char *dev, |
125 | __be32 addr, __be32 mask); | 127 | __be32 addr, __be32 mask); |
128 | #else | ||
129 | static inline void netlbl_af4list_audit_addr(struct audit_buffer *audit_buf, | ||
130 | int src, const char *dev, | ||
131 | __be32 addr, __be32 mask) | ||
132 | { | ||
133 | return; | ||
134 | } | ||
135 | #endif | ||
126 | 136 | ||
127 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 137 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
128 | 138 | ||
@@ -179,11 +189,23 @@ struct netlbl_af6list *netlbl_af6list_search(const struct in6_addr *addr, | |||
179 | struct netlbl_af6list *netlbl_af6list_search_exact(const struct in6_addr *addr, | 189 | struct netlbl_af6list *netlbl_af6list_search_exact(const struct in6_addr *addr, |
180 | const struct in6_addr *mask, | 190 | const struct in6_addr *mask, |
181 | struct list_head *head); | 191 | struct list_head *head); |
192 | |||
193 | #ifdef CONFIG_AUDIT | ||
182 | void netlbl_af6list_audit_addr(struct audit_buffer *audit_buf, | 194 | void netlbl_af6list_audit_addr(struct audit_buffer *audit_buf, |
183 | int src, | 195 | int src, |
184 | const char *dev, | 196 | const char *dev, |
185 | const struct in6_addr *addr, | 197 | const struct in6_addr *addr, |
186 | const struct in6_addr *mask); | 198 | const struct in6_addr *mask); |
199 | #else | ||
200 | static inline void netlbl_af6list_audit_addr(struct audit_buffer *audit_buf, | ||
201 | int src, | ||
202 | const char *dev, | ||
203 | const struct in6_addr *addr, | ||
204 | const struct in6_addr *mask) | ||
205 | { | ||
206 | return; | ||
207 | } | ||
208 | #endif | ||
187 | #endif /* IPV6 */ | 209 | #endif /* IPV6 */ |
188 | 210 | ||
189 | #endif | 211 | #endif |
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c index ee769ecaa13c..0a0ef17b2a40 100644 --- a/net/netlabel/netlabel_mgmt.c +++ b/net/netlabel/netlabel_mgmt.c | |||
@@ -265,7 +265,7 @@ add_failure: | |||
265 | static int netlbl_mgmt_listentry(struct sk_buff *skb, | 265 | static int netlbl_mgmt_listentry(struct sk_buff *skb, |
266 | struct netlbl_dom_map *entry) | 266 | struct netlbl_dom_map *entry) |
267 | { | 267 | { |
268 | int ret_val; | 268 | int ret_val = 0; |
269 | struct nlattr *nla_a; | 269 | struct nlattr *nla_a; |
270 | struct nlattr *nla_b; | 270 | struct nlattr *nla_b; |
271 | struct netlbl_af4list *iter4; | 271 | struct netlbl_af4list *iter4; |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index dc504d308ec0..4d3c6071b9a4 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -2213,7 +2213,7 @@ static int unix_net_init(struct net *net) | |||
2213 | #endif | 2213 | #endif |
2214 | error = 0; | 2214 | error = 0; |
2215 | out: | 2215 | out: |
2216 | return 0; | 2216 | return error; |
2217 | } | 2217 | } |
2218 | 2218 | ||
2219 | static void unix_net_exit(struct net *net) | 2219 | static void unix_net_exit(struct net *net) |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 832b47c1de80..25872747762c 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1251,6 +1251,8 @@ xfrm_tmpl_resolve_one(struct xfrm_policy *policy, struct flowi *fl, | |||
1251 | -EINVAL : -EAGAIN); | 1251 | -EINVAL : -EAGAIN); |
1252 | xfrm_state_put(x); | 1252 | xfrm_state_put(x); |
1253 | } | 1253 | } |
1254 | else if (error == -ESRCH) | ||
1255 | error = -EAGAIN; | ||
1254 | 1256 | ||
1255 | if (!tmpl->optional) | 1257 | if (!tmpl->optional) |
1256 | goto fail; | 1258 | goto fail; |