diff options
Diffstat (limited to 'net/ipv4/af_inet.c')
-rw-r--r-- | net/ipv4/af_inet.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 24b384b7903e..e225a4e5b572 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -263,21 +263,6 @@ void build_ehash_secret(void) | |||
263 | } | 263 | } |
264 | EXPORT_SYMBOL(build_ehash_secret); | 264 | EXPORT_SYMBOL(build_ehash_secret); |
265 | 265 | ||
266 | static inline int inet_netns_ok(struct net *net, __u8 protocol) | ||
267 | { | ||
268 | const struct net_protocol *ipprot; | ||
269 | |||
270 | if (net_eq(net, &init_net)) | ||
271 | return 1; | ||
272 | |||
273 | ipprot = rcu_dereference(inet_protos[protocol]); | ||
274 | if (ipprot == NULL) { | ||
275 | /* raw IP is OK */ | ||
276 | return 1; | ||
277 | } | ||
278 | return ipprot->netns_ok; | ||
279 | } | ||
280 | |||
281 | /* | 266 | /* |
282 | * Create an inet socket. | 267 | * Create an inet socket. |
283 | */ | 268 | */ |
@@ -350,10 +335,6 @@ lookup_protocol: | |||
350 | !ns_capable(net->user_ns, CAP_NET_RAW)) | 335 | !ns_capable(net->user_ns, CAP_NET_RAW)) |
351 | goto out_rcu_unlock; | 336 | goto out_rcu_unlock; |
352 | 337 | ||
353 | err = -EAFNOSUPPORT; | ||
354 | if (!inet_netns_ok(net, protocol)) | ||
355 | goto out_rcu_unlock; | ||
356 | |||
357 | sock->ops = answer->ops; | 338 | sock->ops = answer->ops; |
358 | answer_prot = answer->prot; | 339 | answer_prot = answer->prot; |
359 | answer_no_check = answer->no_check; | 340 | answer_no_check = answer->no_check; |
@@ -1306,6 +1287,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb, | |||
1306 | SKB_GSO_UDP | | 1287 | SKB_GSO_UDP | |
1307 | SKB_GSO_DODGY | | 1288 | SKB_GSO_DODGY | |
1308 | SKB_GSO_TCP_ECN | | 1289 | SKB_GSO_TCP_ECN | |
1290 | SKB_GSO_GRE | | ||
1309 | 0))) | 1291 | 0))) |
1310 | goto out; | 1292 | goto out; |
1311 | 1293 | ||
@@ -1333,7 +1315,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb, | |||
1333 | segs = ops->callbacks.gso_segment(skb, features); | 1315 | segs = ops->callbacks.gso_segment(skb, features); |
1334 | rcu_read_unlock(); | 1316 | rcu_read_unlock(); |
1335 | 1317 | ||
1336 | if (!segs || IS_ERR(segs)) | 1318 | if (IS_ERR_OR_NULL(segs)) |
1337 | goto out; | 1319 | goto out; |
1338 | 1320 | ||
1339 | skb = segs; | 1321 | skb = segs; |
@@ -1705,12 +1687,11 @@ static struct packet_type ip_packet_type __read_mostly = { | |||
1705 | 1687 | ||
1706 | static int __init inet_init(void) | 1688 | static int __init inet_init(void) |
1707 | { | 1689 | { |
1708 | struct sk_buff *dummy_skb; | ||
1709 | struct inet_protosw *q; | 1690 | struct inet_protosw *q; |
1710 | struct list_head *r; | 1691 | struct list_head *r; |
1711 | int rc = -EINVAL; | 1692 | int rc = -EINVAL; |
1712 | 1693 | ||
1713 | BUILD_BUG_ON(sizeof(struct inet_skb_parm) > sizeof(dummy_skb->cb)); | 1694 | BUILD_BUG_ON(sizeof(struct inet_skb_parm) > FIELD_SIZEOF(struct sk_buff, cb)); |
1714 | 1695 | ||
1715 | sysctl_local_reserved_ports = kzalloc(65536 / 8, GFP_KERNEL); | 1696 | sysctl_local_reserved_ports = kzalloc(65536 / 8, GFP_KERNEL); |
1716 | if (!sysctl_local_reserved_ports) | 1697 | if (!sysctl_local_reserved_ports) |