diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-06-25 06:36:55 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-25 06:36:55 -0400 |
commit | f6477cc76c73833a56e97f1fafc36a7ca92927e5 (patch) | |
tree | 9b4ca3d9fa63ea001d516834c8b2707094f3f711 /net | |
parent | fd2c17e1777d46cff14c25ea774a4d17459d188a (diff) | |
parent | 543cf4cb3fe6f6cae3651ba918b9c56200b257d0 (diff) |
Merge branch 'linus' into x86/timers
Diffstat (limited to 'net')
-rw-r--r-- | net/atm/br2684.c | 78 | ||||
-rw-r--r-- | net/core/dev.c | 38 | ||||
-rw-r--r-- | net/core/net_namespace.c | 3 | ||||
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 6 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_core.c | 3 | ||||
-rw-r--r-- | net/ipv4/raw.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 4 | ||||
-rw-r--r-- | net/ipv4/xfrm4_mode_tunnel.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_input.c | 9 | ||||
-rw-r--r-- | net/ipv6/ipv6_sockglue.c | 11 | ||||
-rw-r--r-- | net/ipv6/sit.c | 44 | ||||
-rw-r--r-- | net/mac80211/tx.c | 13 | ||||
-rw-r--r-- | net/mac80211/wext.c | 3 | ||||
-rw-r--r-- | net/mac80211/wme.c | 2 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_extend.c | 9 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_h323_main.c | 22 | ||||
-rw-r--r-- | net/netlink/genetlink.c | 15 | ||||
-rw-r--r-- | net/sched/sch_htb.c | 23 | ||||
-rw-r--r-- | net/sctp/associola.c | 13 | ||||
-rw-r--r-- | net/sctp/protocol.c | 15 | ||||
-rw-r--r-- | net/sctp/socket.c | 4 | ||||
-rw-r--r-- | net/unix/af_unix.c | 79 |
22 files changed, 277 insertions, 121 deletions
diff --git a/net/atm/br2684.c b/net/atm/br2684.c index 9d52ebfc1962..05fafdc2eea3 100644 --- a/net/atm/br2684.c +++ b/net/atm/br2684.c | |||
@@ -188,10 +188,13 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev, | |||
188 | return 0; | 188 | return 0; |
189 | } | 189 | } |
190 | } | 190 | } |
191 | } else { | 191 | } else { /* e_vc */ |
192 | skb_push(skb, 2); | 192 | if (brdev->payload == p_bridged) { |
193 | if (brdev->payload == p_bridged) | 193 | skb_push(skb, 2); |
194 | memset(skb->data, 0, 2); | 194 | memset(skb->data, 0, 2); |
195 | } else { /* p_routed */ | ||
196 | skb_pull(skb, ETH_HLEN); | ||
197 | } | ||
195 | } | 198 | } |
196 | skb_debug(skb); | 199 | skb_debug(skb); |
197 | 200 | ||
@@ -377,11 +380,8 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb) | |||
377 | (skb->data + 6, ethertype_ipv4, | 380 | (skb->data + 6, ethertype_ipv4, |
378 | sizeof(ethertype_ipv4)) == 0) | 381 | sizeof(ethertype_ipv4)) == 0) |
379 | skb->protocol = __constant_htons(ETH_P_IP); | 382 | skb->protocol = __constant_htons(ETH_P_IP); |
380 | else { | 383 | else |
381 | brdev->stats.rx_errors++; | 384 | goto error; |
382 | dev_kfree_skb(skb); | ||
383 | return; | ||
384 | } | ||
385 | skb_pull(skb, sizeof(llc_oui_ipv4)); | 385 | skb_pull(skb, sizeof(llc_oui_ipv4)); |
386 | skb_reset_network_header(skb); | 386 | skb_reset_network_header(skb); |
387 | skb->pkt_type = PACKET_HOST; | 387 | skb->pkt_type = PACKET_HOST; |
@@ -394,44 +394,56 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb) | |||
394 | (memcmp(skb->data, llc_oui_pid_pad, 7) == 0)) { | 394 | (memcmp(skb->data, llc_oui_pid_pad, 7) == 0)) { |
395 | skb_pull(skb, sizeof(llc_oui_pid_pad)); | 395 | skb_pull(skb, sizeof(llc_oui_pid_pad)); |
396 | skb->protocol = eth_type_trans(skb, net_dev); | 396 | skb->protocol = eth_type_trans(skb, net_dev); |
397 | } else { | 397 | } else |
398 | brdev->stats.rx_errors++; | 398 | goto error; |
399 | dev_kfree_skb(skb); | ||
400 | return; | ||
401 | } | ||
402 | 399 | ||
403 | } else { | 400 | } else { /* e_vc */ |
404 | /* first 2 chars should be 0 */ | 401 | if (brdev->payload == p_routed) { |
405 | if (*((u16 *) (skb->data)) != 0) { | 402 | struct iphdr *iph; |
406 | brdev->stats.rx_errors++; | 403 | |
407 | dev_kfree_skb(skb); | 404 | skb_reset_network_header(skb); |
408 | return; | 405 | iph = ip_hdr(skb); |
406 | if (iph->version == 4) | ||
407 | skb->protocol = __constant_htons(ETH_P_IP); | ||
408 | else if (iph->version == 6) | ||
409 | skb->protocol = __constant_htons(ETH_P_IPV6); | ||
410 | else | ||
411 | goto error; | ||
412 | skb->pkt_type = PACKET_HOST; | ||
413 | } else { /* p_bridged */ | ||
414 | /* first 2 chars should be 0 */ | ||
415 | if (*((u16 *) (skb->data)) != 0) | ||
416 | goto error; | ||
417 | skb_pull(skb, BR2684_PAD_LEN); | ||
418 | skb->protocol = eth_type_trans(skb, net_dev); | ||
409 | } | 419 | } |
410 | skb_pull(skb, BR2684_PAD_LEN + ETH_HLEN); /* pad, dstmac, srcmac, ethtype */ | ||
411 | skb->protocol = eth_type_trans(skb, net_dev); | ||
412 | } | 420 | } |
413 | 421 | ||
414 | #ifdef CONFIG_ATM_BR2684_IPFILTER | 422 | #ifdef CONFIG_ATM_BR2684_IPFILTER |
415 | if (unlikely(packet_fails_filter(skb->protocol, brvcc, skb))) { | 423 | if (unlikely(packet_fails_filter(skb->protocol, brvcc, skb))) |
416 | brdev->stats.rx_dropped++; | 424 | goto dropped; |
417 | dev_kfree_skb(skb); | ||
418 | return; | ||
419 | } | ||
420 | #endif /* CONFIG_ATM_BR2684_IPFILTER */ | 425 | #endif /* CONFIG_ATM_BR2684_IPFILTER */ |
421 | skb->dev = net_dev; | 426 | skb->dev = net_dev; |
422 | ATM_SKB(skb)->vcc = atmvcc; /* needed ? */ | 427 | ATM_SKB(skb)->vcc = atmvcc; /* needed ? */ |
423 | pr_debug("received packet's protocol: %x\n", ntohs(skb->protocol)); | 428 | pr_debug("received packet's protocol: %x\n", ntohs(skb->protocol)); |
424 | skb_debug(skb); | 429 | skb_debug(skb); |
425 | if (unlikely(!(net_dev->flags & IFF_UP))) { | 430 | /* sigh, interface is down? */ |
426 | /* sigh, interface is down */ | 431 | if (unlikely(!(net_dev->flags & IFF_UP))) |
427 | brdev->stats.rx_dropped++; | 432 | goto dropped; |
428 | dev_kfree_skb(skb); | ||
429 | return; | ||
430 | } | ||
431 | brdev->stats.rx_packets++; | 433 | brdev->stats.rx_packets++; |
432 | brdev->stats.rx_bytes += skb->len; | 434 | brdev->stats.rx_bytes += skb->len; |
433 | memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data)); | 435 | memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data)); |
434 | netif_rx(skb); | 436 | netif_rx(skb); |
437 | return; | ||
438 | |||
439 | dropped: | ||
440 | brdev->stats.rx_dropped++; | ||
441 | goto free_skb; | ||
442 | error: | ||
443 | brdev->stats.rx_errors++; | ||
444 | free_skb: | ||
445 | dev_kfree_skb(skb); | ||
446 | return; | ||
435 | } | 447 | } |
436 | 448 | ||
437 | /* | 449 | /* |
@@ -518,9 +530,9 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg) | |||
518 | struct sk_buff *next = skb->next; | 530 | struct sk_buff *next = skb->next; |
519 | 531 | ||
520 | skb->next = skb->prev = NULL; | 532 | skb->next = skb->prev = NULL; |
533 | br2684_push(atmvcc, skb); | ||
521 | BRPRIV(skb->dev)->stats.rx_bytes -= skb->len; | 534 | BRPRIV(skb->dev)->stats.rx_bytes -= skb->len; |
522 | BRPRIV(skb->dev)->stats.rx_packets--; | 535 | BRPRIV(skb->dev)->stats.rx_packets--; |
523 | br2684_push(atmvcc, skb); | ||
524 | 536 | ||
525 | skb = next; | 537 | skb = next; |
526 | } | 538 | } |
diff --git a/net/core/dev.c b/net/core/dev.c index 582963077877..c421a1f8f0b9 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -119,6 +119,7 @@ | |||
119 | #include <linux/err.h> | 119 | #include <linux/err.h> |
120 | #include <linux/ctype.h> | 120 | #include <linux/ctype.h> |
121 | #include <linux/if_arp.h> | 121 | #include <linux/if_arp.h> |
122 | #include <linux/if_vlan.h> | ||
122 | 123 | ||
123 | #include "net-sysfs.h" | 124 | #include "net-sysfs.h" |
124 | 125 | ||
@@ -1362,6 +1363,29 @@ void netif_device_attach(struct net_device *dev) | |||
1362 | } | 1363 | } |
1363 | EXPORT_SYMBOL(netif_device_attach); | 1364 | EXPORT_SYMBOL(netif_device_attach); |
1364 | 1365 | ||
1366 | static bool can_checksum_protocol(unsigned long features, __be16 protocol) | ||
1367 | { | ||
1368 | return ((features & NETIF_F_GEN_CSUM) || | ||
1369 | ((features & NETIF_F_IP_CSUM) && | ||
1370 | protocol == htons(ETH_P_IP)) || | ||
1371 | ((features & NETIF_F_IPV6_CSUM) && | ||
1372 | protocol == htons(ETH_P_IPV6))); | ||
1373 | } | ||
1374 | |||
1375 | static bool dev_can_checksum(struct net_device *dev, struct sk_buff *skb) | ||
1376 | { | ||
1377 | if (can_checksum_protocol(dev->features, skb->protocol)) | ||
1378 | return true; | ||
1379 | |||
1380 | if (skb->protocol == htons(ETH_P_8021Q)) { | ||
1381 | struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; | ||
1382 | if (can_checksum_protocol(dev->features & dev->vlan_features, | ||
1383 | veh->h_vlan_encapsulated_proto)) | ||
1384 | return true; | ||
1385 | } | ||
1386 | |||
1387 | return false; | ||
1388 | } | ||
1365 | 1389 | ||
1366 | /* | 1390 | /* |
1367 | * Invalidate hardware checksum when packet is to be mangled, and | 1391 | * Invalidate hardware checksum when packet is to be mangled, and |
@@ -1640,14 +1664,8 @@ int dev_queue_xmit(struct sk_buff *skb) | |||
1640 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1664 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1641 | skb_set_transport_header(skb, skb->csum_start - | 1665 | skb_set_transport_header(skb, skb->csum_start - |
1642 | skb_headroom(skb)); | 1666 | skb_headroom(skb)); |
1643 | 1667 | if (!dev_can_checksum(dev, skb) && skb_checksum_help(skb)) | |
1644 | if (!(dev->features & NETIF_F_GEN_CSUM) && | 1668 | goto out_kfree_skb; |
1645 | !((dev->features & NETIF_F_IP_CSUM) && | ||
1646 | skb->protocol == htons(ETH_P_IP)) && | ||
1647 | !((dev->features & NETIF_F_IPV6_CSUM) && | ||
1648 | skb->protocol == htons(ETH_P_IPV6))) | ||
1649 | if (skb_checksum_help(skb)) | ||
1650 | goto out_kfree_skb; | ||
1651 | } | 1669 | } |
1652 | 1670 | ||
1653 | gso: | 1671 | gso: |
@@ -2059,6 +2077,10 @@ int netif_receive_skb(struct sk_buff *skb) | |||
2059 | 2077 | ||
2060 | rcu_read_lock(); | 2078 | rcu_read_lock(); |
2061 | 2079 | ||
2080 | /* Don't receive packets in an exiting network namespace */ | ||
2081 | if (!net_alive(dev_net(skb->dev))) | ||
2082 | goto out; | ||
2083 | |||
2062 | #ifdef CONFIG_NET_CLS_ACT | 2084 | #ifdef CONFIG_NET_CLS_ACT |
2063 | if (skb->tc_verd & TC_NCLS) { | 2085 | if (skb->tc_verd & TC_NCLS) { |
2064 | skb->tc_verd = CLR_TC_NCLS(skb->tc_verd); | 2086 | skb->tc_verd = CLR_TC_NCLS(skb->tc_verd); |
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 72b4c184dd84..7c52fe277b62 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -140,6 +140,9 @@ static void cleanup_net(struct work_struct *work) | |||
140 | struct pernet_operations *ops; | 140 | struct pernet_operations *ops; |
141 | struct net *net; | 141 | struct net *net; |
142 | 142 | ||
143 | /* Be very certain incoming network packets will not find us */ | ||
144 | rcu_barrier(); | ||
145 | |||
143 | net = container_of(work, struct net, work); | 146 | net = container_of(work, struct net, work); |
144 | 147 | ||
145 | mutex_lock(&net_mutex); | 148 | mutex_lock(&net_mutex); |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 045e799d3e1d..ec834480abe7 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -466,9 +466,9 @@ void inet_csk_reqsk_queue_prune(struct sock *parent, | |||
466 | reqp=&lopt->syn_table[i]; | 466 | reqp=&lopt->syn_table[i]; |
467 | while ((req = *reqp) != NULL) { | 467 | while ((req = *reqp) != NULL) { |
468 | if (time_after_eq(now, req->expires)) { | 468 | if (time_after_eq(now, req->expires)) { |
469 | if ((req->retrans < (inet_rsk(req)->acked ? max_retries : thresh)) && | 469 | if ((req->retrans < thresh || |
470 | (inet_rsk(req)->acked || | 470 | (inet_rsk(req)->acked && req->retrans < max_retries)) |
471 | !req->rsk_ops->rtx_syn_ack(parent, req))) { | 471 | && !req->rsk_ops->rtx_syn_ack(parent, req)) { |
472 | unsigned long timeo; | 472 | unsigned long timeo; |
473 | 473 | ||
474 | if (req->retrans++ == 0) | 474 | if (req->retrans++ == 0) |
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index 04578593e100..d2a887fc8d9b 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c | |||
@@ -556,7 +556,6 @@ static void nf_nat_cleanup_conntrack(struct nf_conn *ct) | |||
556 | 556 | ||
557 | spin_lock_bh(&nf_nat_lock); | 557 | spin_lock_bh(&nf_nat_lock); |
558 | hlist_del_rcu(&nat->bysource); | 558 | hlist_del_rcu(&nat->bysource); |
559 | nat->ct = NULL; | ||
560 | spin_unlock_bh(&nf_nat_lock); | 559 | spin_unlock_bh(&nf_nat_lock); |
561 | } | 560 | } |
562 | 561 | ||
@@ -570,8 +569,8 @@ static void nf_nat_move_storage(void *new, void *old) | |||
570 | return; | 569 | return; |
571 | 570 | ||
572 | spin_lock_bh(&nf_nat_lock); | 571 | spin_lock_bh(&nf_nat_lock); |
573 | hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource); | ||
574 | new_nat->ct = ct; | 572 | new_nat->ct = ct; |
573 | hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource); | ||
575 | spin_unlock_bh(&nf_nat_lock); | 574 | spin_unlock_bh(&nf_nat_lock); |
576 | } | 575 | } |
577 | 576 | ||
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index e7e091d365ff..37a1ecd9d600 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -934,7 +934,7 @@ static void raw_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) | |||
934 | srcp = inet->num; | 934 | srcp = inet->num; |
935 | 935 | ||
936 | seq_printf(seq, "%4d: %08X:%04X %08X:%04X" | 936 | seq_printf(seq, "%4d: %08X:%04X %08X:%04X" |
937 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d", | 937 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", |
938 | i, src, srcp, dest, destp, sp->sk_state, | 938 | i, src, srcp, dest, destp, sp->sk_state, |
939 | atomic_read(&sp->sk_wmem_alloc), | 939 | atomic_read(&sp->sk_wmem_alloc), |
940 | atomic_read(&sp->sk_rmem_alloc), | 940 | atomic_read(&sp->sk_rmem_alloc), |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 97a230026e13..12695be2c255 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -85,10 +85,6 @@ | |||
85 | int sysctl_tcp_tw_reuse __read_mostly; | 85 | int sysctl_tcp_tw_reuse __read_mostly; |
86 | int sysctl_tcp_low_latency __read_mostly; | 86 | int sysctl_tcp_low_latency __read_mostly; |
87 | 87 | ||
88 | /* Check TCP sequence numbers in ICMP packets. */ | ||
89 | #define ICMP_MIN_LENGTH 8 | ||
90 | |||
91 | void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb); | ||
92 | 88 | ||
93 | #ifdef CONFIG_TCP_MD5SIG | 89 | #ifdef CONFIG_TCP_MD5SIG |
94 | static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, | 90 | static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, |
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c index 584e6d74e3a9..7135279f3f84 100644 --- a/net/ipv4/xfrm4_mode_tunnel.c +++ b/net/ipv4/xfrm4_mode_tunnel.c | |||
@@ -52,7 +52,7 @@ static int xfrm4_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) | |||
52 | IP_ECN_clear(top_iph); | 52 | IP_ECN_clear(top_iph); |
53 | 53 | ||
54 | top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ? | 54 | top_iph->frag_off = (flags & XFRM_STATE_NOPMTUDISC) ? |
55 | 0 : XFRM_MODE_SKB_CB(skb)->frag_off; | 55 | 0 : (XFRM_MODE_SKB_CB(skb)->frag_off & htons(IP_DF)); |
56 | ip_select_ident(top_iph, dst->child, NULL); | 56 | ip_select_ident(top_iph, dst->child, NULL); |
57 | 57 | ||
58 | top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT); | 58 | top_iph->ttl = dst_metric(dst->child, RTAX_HOPLIMIT); |
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index 4e5c8615832c..17eb48b8e329 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
@@ -102,6 +102,15 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
102 | if (hdr->version != 6) | 102 | if (hdr->version != 6) |
103 | goto err; | 103 | goto err; |
104 | 104 | ||
105 | /* | ||
106 | * RFC4291 2.5.3 | ||
107 | * A packet received on an interface with a destination address | ||
108 | * of loopback must be dropped. | ||
109 | */ | ||
110 | if (!(dev->flags & IFF_LOOPBACK) && | ||
111 | ipv6_addr_loopback(&hdr->daddr)) | ||
112 | goto err; | ||
113 | |||
105 | skb->transport_header = skb->network_header + sizeof(*hdr); | 114 | skb->transport_header = skb->network_header + sizeof(*hdr); |
106 | IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); | 115 | IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); |
107 | 116 | ||
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index c042ce19bd14..86e28a75267f 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -345,18 +345,21 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, | |||
345 | case IPV6_DSTOPTS: | 345 | case IPV6_DSTOPTS: |
346 | { | 346 | { |
347 | struct ipv6_txoptions *opt; | 347 | struct ipv6_txoptions *opt; |
348 | |||
349 | /* remove any sticky options header with a zero option | ||
350 | * length, per RFC3542. | ||
351 | */ | ||
348 | if (optlen == 0) | 352 | if (optlen == 0) |
349 | optval = NULL; | 353 | optval = NULL; |
354 | else if (optlen < sizeof(struct ipv6_opt_hdr) || | ||
355 | optlen & 0x7 || optlen > 8 * 255) | ||
356 | goto e_inval; | ||
350 | 357 | ||
351 | /* hop-by-hop / destination options are privileged option */ | 358 | /* hop-by-hop / destination options are privileged option */ |
352 | retv = -EPERM; | 359 | retv = -EPERM; |
353 | if (optname != IPV6_RTHDR && !capable(CAP_NET_RAW)) | 360 | if (optname != IPV6_RTHDR && !capable(CAP_NET_RAW)) |
354 | break; | 361 | break; |
355 | 362 | ||
356 | if (optlen < sizeof(struct ipv6_opt_hdr) || | ||
357 | optlen & 0x7 || optlen > 8 * 255) | ||
358 | goto e_inval; | ||
359 | |||
360 | opt = ipv6_renew_options(sk, np->opt, optname, | 363 | opt = ipv6_renew_options(sk, np->opt, optname, |
361 | (struct ipv6_opt_hdr __user *)optval, | 364 | (struct ipv6_opt_hdr __user *)optval, |
362 | optlen); | 365 | optlen); |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 3de6ffdaedf2..32e871a6c25a 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -222,15 +222,18 @@ __ipip6_tunnel_locate_prl(struct ip_tunnel *t, __be32 addr) | |||
222 | 222 | ||
223 | } | 223 | } |
224 | 224 | ||
225 | static int ipip6_tunnel_get_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a) | 225 | static int ipip6_tunnel_get_prl(struct ip_tunnel *t, |
226 | struct ip_tunnel_prl __user *a) | ||
226 | { | 227 | { |
227 | struct ip_tunnel_prl *kp; | 228 | struct ip_tunnel_prl kprl, *kp; |
228 | struct ip_tunnel_prl_entry *prl; | 229 | struct ip_tunnel_prl_entry *prl; |
229 | unsigned int cmax, c = 0, ca, len; | 230 | unsigned int cmax, c = 0, ca, len; |
230 | int ret = 0; | 231 | int ret = 0; |
231 | 232 | ||
232 | cmax = a->datalen / sizeof(*a); | 233 | if (copy_from_user(&kprl, a, sizeof(kprl))) |
233 | if (cmax > 1 && a->addr != htonl(INADDR_ANY)) | 234 | return -EFAULT; |
235 | cmax = kprl.datalen / sizeof(kprl); | ||
236 | if (cmax > 1 && kprl.addr != htonl(INADDR_ANY)) | ||
234 | cmax = 1; | 237 | cmax = 1; |
235 | 238 | ||
236 | /* For simple GET or for root users, | 239 | /* For simple GET or for root users, |
@@ -261,26 +264,25 @@ static int ipip6_tunnel_get_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a) | |||
261 | for (prl = t->prl; prl; prl = prl->next) { | 264 | for (prl = t->prl; prl; prl = prl->next) { |
262 | if (c > cmax) | 265 | if (c > cmax) |
263 | break; | 266 | break; |
264 | if (a->addr != htonl(INADDR_ANY) && prl->addr != a->addr) | 267 | if (kprl.addr != htonl(INADDR_ANY) && prl->addr != kprl.addr) |
265 | continue; | 268 | continue; |
266 | kp[c].addr = prl->addr; | 269 | kp[c].addr = prl->addr; |
267 | kp[c].flags = prl->flags; | 270 | kp[c].flags = prl->flags; |
268 | c++; | 271 | c++; |
269 | if (a->addr != htonl(INADDR_ANY)) | 272 | if (kprl.addr != htonl(INADDR_ANY)) |
270 | break; | 273 | break; |
271 | } | 274 | } |
272 | out: | 275 | out: |
273 | read_unlock(&ipip6_lock); | 276 | read_unlock(&ipip6_lock); |
274 | 277 | ||
275 | len = sizeof(*kp) * c; | 278 | len = sizeof(*kp) * c; |
276 | ret = len ? copy_to_user(a->data, kp, len) : 0; | 279 | ret = 0; |
280 | if ((len && copy_to_user(a + 1, kp, len)) || put_user(len, &a->datalen)) | ||
281 | ret = -EFAULT; | ||
277 | 282 | ||
278 | kfree(kp); | 283 | kfree(kp); |
279 | if (ret) | ||
280 | return -EFAULT; | ||
281 | 284 | ||
282 | a->datalen = len; | 285 | return ret; |
283 | return 0; | ||
284 | } | 286 | } |
285 | 287 | ||
286 | static int | 288 | static int |
@@ -873,11 +875,20 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) | |||
873 | break; | 875 | break; |
874 | 876 | ||
875 | case SIOCGETPRL: | 877 | case SIOCGETPRL: |
878 | err = -EINVAL; | ||
879 | if (dev == sitn->fb_tunnel_dev) | ||
880 | goto done; | ||
881 | err = -ENOENT; | ||
882 | if (!(t = netdev_priv(dev))) | ||
883 | goto done; | ||
884 | err = ipip6_tunnel_get_prl(t, ifr->ifr_ifru.ifru_data); | ||
885 | break; | ||
886 | |||
876 | case SIOCADDPRL: | 887 | case SIOCADDPRL: |
877 | case SIOCDELPRL: | 888 | case SIOCDELPRL: |
878 | case SIOCCHGPRL: | 889 | case SIOCCHGPRL: |
879 | err = -EPERM; | 890 | err = -EPERM; |
880 | if (cmd != SIOCGETPRL && !capable(CAP_NET_ADMIN)) | 891 | if (!capable(CAP_NET_ADMIN)) |
881 | goto done; | 892 | goto done; |
882 | err = -EINVAL; | 893 | err = -EINVAL; |
883 | if (dev == sitn->fb_tunnel_dev) | 894 | if (dev == sitn->fb_tunnel_dev) |
@@ -890,12 +901,6 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) | |||
890 | goto done; | 901 | goto done; |
891 | 902 | ||
892 | switch (cmd) { | 903 | switch (cmd) { |
893 | case SIOCGETPRL: | ||
894 | err = ipip6_tunnel_get_prl(t, &prl); | ||
895 | if (!err && copy_to_user(ifr->ifr_ifru.ifru_data, | ||
896 | &prl, sizeof(prl))) | ||
897 | err = -EFAULT; | ||
898 | break; | ||
899 | case SIOCDELPRL: | 904 | case SIOCDELPRL: |
900 | err = ipip6_tunnel_del_prl(t, &prl); | 905 | err = ipip6_tunnel_del_prl(t, &prl); |
901 | break; | 906 | break; |
@@ -904,8 +909,7 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) | |||
904 | err = ipip6_tunnel_add_prl(t, &prl, cmd == SIOCCHGPRL); | 909 | err = ipip6_tunnel_add_prl(t, &prl, cmd == SIOCCHGPRL); |
905 | break; | 910 | break; |
906 | } | 911 | } |
907 | if (cmd != SIOCGETPRL) | 912 | netdev_state_change(dev); |
908 | netdev_state_change(dev); | ||
909 | break; | 913 | break; |
910 | 914 | ||
911 | default: | 915 | default: |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 1d7dd54aacef..c80d5899f279 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1132,7 +1132,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, | |||
1132 | ieee80211_tx_handler *handler; | 1132 | ieee80211_tx_handler *handler; |
1133 | struct ieee80211_tx_data tx; | 1133 | struct ieee80211_tx_data tx; |
1134 | ieee80211_tx_result res = TX_DROP, res_prepare; | 1134 | ieee80211_tx_result res = TX_DROP, res_prepare; |
1135 | int ret, i; | 1135 | int ret, i, retries = 0; |
1136 | 1136 | ||
1137 | WARN_ON(__ieee80211_queue_pending(local, control->queue)); | 1137 | WARN_ON(__ieee80211_queue_pending(local, control->queue)); |
1138 | 1138 | ||
@@ -1216,6 +1216,13 @@ retry: | |||
1216 | if (!__ieee80211_queue_stopped(local, control->queue)) { | 1216 | if (!__ieee80211_queue_stopped(local, control->queue)) { |
1217 | clear_bit(IEEE80211_LINK_STATE_PENDING, | 1217 | clear_bit(IEEE80211_LINK_STATE_PENDING, |
1218 | &local->state[control->queue]); | 1218 | &local->state[control->queue]); |
1219 | retries++; | ||
1220 | /* | ||
1221 | * Driver bug, it's rejecting packets but | ||
1222 | * not stopping queues. | ||
1223 | */ | ||
1224 | if (WARN_ON_ONCE(retries > 5)) | ||
1225 | goto drop; | ||
1219 | goto retry; | 1226 | goto retry; |
1220 | } | 1227 | } |
1221 | memcpy(&store->control, control, | 1228 | memcpy(&store->control, control, |
@@ -1562,13 +1569,13 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1562 | * be cloned. This could happen, e.g., with Linux bridge code passing | 1569 | * be cloned. This could happen, e.g., with Linux bridge code passing |
1563 | * us broadcast frames. */ | 1570 | * us broadcast frames. */ |
1564 | 1571 | ||
1565 | if (head_need > 0 || skb_header_cloned(skb)) { | 1572 | if (head_need > 0 || skb_cloned(skb)) { |
1566 | #if 0 | 1573 | #if 0 |
1567 | printk(KERN_DEBUG "%s: need to reallocate buffer for %d bytes " | 1574 | printk(KERN_DEBUG "%s: need to reallocate buffer for %d bytes " |
1568 | "of headroom\n", dev->name, head_need); | 1575 | "of headroom\n", dev->name, head_need); |
1569 | #endif | 1576 | #endif |
1570 | 1577 | ||
1571 | if (skb_header_cloned(skb)) | 1578 | if (skb_cloned(skb)) |
1572 | I802_DEBUG_INC(local->tx_expand_skb_head_cloned); | 1579 | I802_DEBUG_INC(local->tx_expand_skb_head_cloned); |
1573 | else | 1580 | else |
1574 | I802_DEBUG_INC(local->tx_expand_skb_head); | 1581 | I802_DEBUG_INC(local->tx_expand_skb_head); |
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index a8bb8e31b1ec..6106cb79060c 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -496,7 +496,8 @@ static int ieee80211_ioctl_giwap(struct net_device *dev, | |||
496 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 496 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
497 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 497 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
498 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 498 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
499 | if (sdata->u.sta.state == IEEE80211_ASSOCIATED) { | 499 | if (sdata->u.sta.state == IEEE80211_ASSOCIATED || |
500 | sdata->u.sta.state == IEEE80211_IBSS_JOINED) { | ||
500 | ap_addr->sa_family = ARPHRD_ETHER; | 501 | ap_addr->sa_family = ARPHRD_ETHER; |
501 | memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); | 502 | memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); |
502 | return 0; | 503 | return 0; |
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c index dc1598b86004..635b996c8c35 100644 --- a/net/mac80211/wme.c +++ b/net/mac80211/wme.c | |||
@@ -673,7 +673,7 @@ int ieee80211_ht_agg_queue_add(struct ieee80211_local *local, | |||
673 | #ifdef CONFIG_MAC80211_HT_DEBUG | 673 | #ifdef CONFIG_MAC80211_HT_DEBUG |
674 | if (net_ratelimit()) | 674 | if (net_ratelimit()) |
675 | printk(KERN_DEBUG "allocated aggregation queue" | 675 | printk(KERN_DEBUG "allocated aggregation queue" |
676 | " %d tid %d addr %s pool=0x%lX", | 676 | " %d tid %d addr %s pool=0x%lX\n", |
677 | i, tid, print_mac(mac, sta->addr), | 677 | i, tid, print_mac(mac, sta->addr), |
678 | q->qdisc_pool[0]); | 678 | q->qdisc_pool[0]); |
679 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 679 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
diff --git a/net/netfilter/nf_conntrack_extend.c b/net/netfilter/nf_conntrack_extend.c index bcc19fa4ed1e..8a3f8b34e466 100644 --- a/net/netfilter/nf_conntrack_extend.c +++ b/net/netfilter/nf_conntrack_extend.c | |||
@@ -59,12 +59,19 @@ nf_ct_ext_create(struct nf_ct_ext **ext, enum nf_ct_ext_id id, gfp_t gfp) | |||
59 | if (!*ext) | 59 | if (!*ext) |
60 | return NULL; | 60 | return NULL; |
61 | 61 | ||
62 | INIT_RCU_HEAD(&(*ext)->rcu); | ||
62 | (*ext)->offset[id] = off; | 63 | (*ext)->offset[id] = off; |
63 | (*ext)->len = len; | 64 | (*ext)->len = len; |
64 | 65 | ||
65 | return (void *)(*ext) + off; | 66 | return (void *)(*ext) + off; |
66 | } | 67 | } |
67 | 68 | ||
69 | static void __nf_ct_ext_free_rcu(struct rcu_head *head) | ||
70 | { | ||
71 | struct nf_ct_ext *ext = container_of(head, struct nf_ct_ext, rcu); | ||
72 | kfree(ext); | ||
73 | } | ||
74 | |||
68 | void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp) | 75 | void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp) |
69 | { | 76 | { |
70 | struct nf_ct_ext *new; | 77 | struct nf_ct_ext *new; |
@@ -106,7 +113,7 @@ void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp) | |||
106 | (void *)ct->ext + ct->ext->offset[i]); | 113 | (void *)ct->ext + ct->ext->offset[i]); |
107 | rcu_read_unlock(); | 114 | rcu_read_unlock(); |
108 | } | 115 | } |
109 | kfree(ct->ext); | 116 | call_rcu(&ct->ext->rcu, __nf_ct_ext_free_rcu); |
110 | ct->ext = new; | 117 | ct->ext = new; |
111 | } | 118 | } |
112 | 119 | ||
diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c index 95da1a24aab7..2f83c158934d 100644 --- a/net/netfilter/nf_conntrack_h323_main.c +++ b/net/netfilter/nf_conntrack_h323_main.c | |||
@@ -619,6 +619,7 @@ static const struct nf_conntrack_expect_policy h245_exp_policy = { | |||
619 | static struct nf_conntrack_helper nf_conntrack_helper_h245 __read_mostly = { | 619 | static struct nf_conntrack_helper nf_conntrack_helper_h245 __read_mostly = { |
620 | .name = "H.245", | 620 | .name = "H.245", |
621 | .me = THIS_MODULE, | 621 | .me = THIS_MODULE, |
622 | .tuple.src.l3num = AF_UNSPEC, | ||
622 | .tuple.dst.protonum = IPPROTO_UDP, | 623 | .tuple.dst.protonum = IPPROTO_UDP, |
623 | .help = h245_help, | 624 | .help = h245_help, |
624 | .expect_policy = &h245_exp_policy, | 625 | .expect_policy = &h245_exp_policy, |
@@ -1765,6 +1766,7 @@ static void __exit nf_conntrack_h323_fini(void) | |||
1765 | nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]); | 1766 | nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]); |
1766 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); | 1767 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); |
1767 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); | 1768 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); |
1769 | nf_conntrack_helper_unregister(&nf_conntrack_helper_h245); | ||
1768 | kfree(h323_buffer); | 1770 | kfree(h323_buffer); |
1769 | pr_debug("nf_ct_h323: fini\n"); | 1771 | pr_debug("nf_ct_h323: fini\n"); |
1770 | } | 1772 | } |
@@ -1777,28 +1779,34 @@ static int __init nf_conntrack_h323_init(void) | |||
1777 | h323_buffer = kmalloc(65536, GFP_KERNEL); | 1779 | h323_buffer = kmalloc(65536, GFP_KERNEL); |
1778 | if (!h323_buffer) | 1780 | if (!h323_buffer) |
1779 | return -ENOMEM; | 1781 | return -ENOMEM; |
1780 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[0]); | 1782 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_h245); |
1781 | if (ret < 0) | 1783 | if (ret < 0) |
1782 | goto err1; | 1784 | goto err1; |
1783 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[1]); | 1785 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[0]); |
1784 | if (ret < 0) | 1786 | if (ret < 0) |
1785 | goto err2; | 1787 | goto err2; |
1786 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[0]); | 1788 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_q931[1]); |
1787 | if (ret < 0) | 1789 | if (ret < 0) |
1788 | goto err3; | 1790 | goto err3; |
1789 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[1]); | 1791 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[0]); |
1790 | if (ret < 0) | 1792 | if (ret < 0) |
1791 | goto err4; | 1793 | goto err4; |
1794 | ret = nf_conntrack_helper_register(&nf_conntrack_helper_ras[1]); | ||
1795 | if (ret < 0) | ||
1796 | goto err5; | ||
1792 | pr_debug("nf_ct_h323: init success\n"); | 1797 | pr_debug("nf_ct_h323: init success\n"); |
1793 | return 0; | 1798 | return 0; |
1794 | 1799 | ||
1795 | err4: | 1800 | err5: |
1796 | nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]); | 1801 | nf_conntrack_helper_unregister(&nf_conntrack_helper_ras[0]); |
1797 | err3: | 1802 | err4: |
1798 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); | 1803 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[1]); |
1799 | err2: | 1804 | err3: |
1800 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); | 1805 | nf_conntrack_helper_unregister(&nf_conntrack_helper_q931[0]); |
1806 | err2: | ||
1807 | nf_conntrack_helper_unregister(&nf_conntrack_helper_h245); | ||
1801 | err1: | 1808 | err1: |
1809 | kfree(h323_buffer); | ||
1802 | return ret; | 1810 | return ret; |
1803 | } | 1811 | } |
1804 | 1812 | ||
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index f5aa23c3e886..3e1191cecaf0 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -444,8 +444,11 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
444 | if (ops->dumpit == NULL) | 444 | if (ops->dumpit == NULL) |
445 | return -EOPNOTSUPP; | 445 | return -EOPNOTSUPP; |
446 | 446 | ||
447 | return netlink_dump_start(genl_sock, skb, nlh, | 447 | genl_unlock(); |
448 | ops->dumpit, ops->done); | 448 | err = netlink_dump_start(genl_sock, skb, nlh, |
449 | ops->dumpit, ops->done); | ||
450 | genl_lock(); | ||
451 | return err; | ||
449 | } | 452 | } |
450 | 453 | ||
451 | if (ops->doit == NULL) | 454 | if (ops->doit == NULL) |
@@ -603,9 +606,6 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb) | |||
603 | int chains_to_skip = cb->args[0]; | 606 | int chains_to_skip = cb->args[0]; |
604 | int fams_to_skip = cb->args[1]; | 607 | int fams_to_skip = cb->args[1]; |
605 | 608 | ||
606 | if (chains_to_skip != 0) | ||
607 | genl_lock(); | ||
608 | |||
609 | for (i = 0; i < GENL_FAM_TAB_SIZE; i++) { | 609 | for (i = 0; i < GENL_FAM_TAB_SIZE; i++) { |
610 | if (i < chains_to_skip) | 610 | if (i < chains_to_skip) |
611 | continue; | 611 | continue; |
@@ -623,9 +623,6 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb) | |||
623 | } | 623 | } |
624 | 624 | ||
625 | errout: | 625 | errout: |
626 | if (chains_to_skip != 0) | ||
627 | genl_unlock(); | ||
628 | |||
629 | cb->args[0] = i; | 626 | cb->args[0] = i; |
630 | cb->args[1] = n; | 627 | cb->args[1] = n; |
631 | 628 | ||
@@ -770,7 +767,7 @@ static int __init genl_init(void) | |||
770 | 767 | ||
771 | /* we'll bump the group number right afterwards */ | 768 | /* we'll bump the group number right afterwards */ |
772 | genl_sock = netlink_kernel_create(&init_net, NETLINK_GENERIC, 0, | 769 | genl_sock = netlink_kernel_create(&init_net, NETLINK_GENERIC, 0, |
773 | genl_rcv, NULL, THIS_MODULE); | 770 | genl_rcv, &genl_mutex, THIS_MODULE); |
774 | if (genl_sock == NULL) | 771 | if (genl_sock == NULL) |
775 | panic("GENL: Cannot initialize generic netlink\n"); | 772 | panic("GENL: Cannot initialize generic netlink\n"); |
776 | 773 | ||
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 5bc1ed490180..6807c97985a5 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -28,6 +28,7 @@ | |||
28 | * $Id: sch_htb.c,v 1.25 2003/12/07 11:08:25 devik Exp devik $ | 28 | * $Id: sch_htb.c,v 1.25 2003/12/07 11:08:25 devik Exp devik $ |
29 | */ | 29 | */ |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/moduleparam.h> | ||
31 | #include <linux/types.h> | 32 | #include <linux/types.h> |
32 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
33 | #include <linux/string.h> | 34 | #include <linux/string.h> |
@@ -53,13 +54,17 @@ | |||
53 | */ | 54 | */ |
54 | 55 | ||
55 | #define HTB_HSIZE 16 /* classid hash size */ | 56 | #define HTB_HSIZE 16 /* classid hash size */ |
56 | #define HTB_HYSTERESIS 1 /* whether to use mode hysteresis for speedup */ | 57 | static int htb_hysteresis __read_mostly = 0; /* whether to use mode hysteresis for speedup */ |
57 | #define HTB_VER 0x30011 /* major must be matched with number suplied by TC as version */ | 58 | #define HTB_VER 0x30011 /* major must be matched with number suplied by TC as version */ |
58 | 59 | ||
59 | #if HTB_VER >> 16 != TC_HTB_PROTOVER | 60 | #if HTB_VER >> 16 != TC_HTB_PROTOVER |
60 | #error "Mismatched sch_htb.c and pkt_sch.h" | 61 | #error "Mismatched sch_htb.c and pkt_sch.h" |
61 | #endif | 62 | #endif |
62 | 63 | ||
64 | /* Module parameter and sysfs export */ | ||
65 | module_param (htb_hysteresis, int, 0640); | ||
66 | MODULE_PARM_DESC(htb_hysteresis, "Hysteresis mode, less CPU load, less accurate"); | ||
67 | |||
63 | /* used internaly to keep status of single class */ | 68 | /* used internaly to keep status of single class */ |
64 | enum htb_cmode { | 69 | enum htb_cmode { |
65 | HTB_CANT_SEND, /* class can't send and can't borrow */ | 70 | HTB_CANT_SEND, /* class can't send and can't borrow */ |
@@ -462,19 +467,21 @@ static void htb_deactivate_prios(struct htb_sched *q, struct htb_class *cl) | |||
462 | htb_remove_class_from_row(q, cl, mask); | 467 | htb_remove_class_from_row(q, cl, mask); |
463 | } | 468 | } |
464 | 469 | ||
465 | #if HTB_HYSTERESIS | ||
466 | static inline long htb_lowater(const struct htb_class *cl) | 470 | static inline long htb_lowater(const struct htb_class *cl) |
467 | { | 471 | { |
468 | return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0; | 472 | if (htb_hysteresis) |
473 | return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0; | ||
474 | else | ||
475 | return 0; | ||
469 | } | 476 | } |
470 | static inline long htb_hiwater(const struct htb_class *cl) | 477 | static inline long htb_hiwater(const struct htb_class *cl) |
471 | { | 478 | { |
472 | return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0; | 479 | if (htb_hysteresis) |
480 | return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0; | ||
481 | else | ||
482 | return 0; | ||
473 | } | 483 | } |
474 | #else | 484 | |
475 | #define htb_lowater(cl) (0) | ||
476 | #define htb_hiwater(cl) (0) | ||
477 | #endif | ||
478 | 485 | ||
479 | /** | 486 | /** |
480 | * htb_class_mode - computes and returns current class mode | 487 | * htb_class_mode - computes and returns current class mode |
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 532634861db1..024c3ebd9661 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -474,6 +474,15 @@ static void sctp_association_destroy(struct sctp_association *asoc) | |||
474 | void sctp_assoc_set_primary(struct sctp_association *asoc, | 474 | void sctp_assoc_set_primary(struct sctp_association *asoc, |
475 | struct sctp_transport *transport) | 475 | struct sctp_transport *transport) |
476 | { | 476 | { |
477 | int changeover = 0; | ||
478 | |||
479 | /* it's a changeover only if we already have a primary path | ||
480 | * that we are changing | ||
481 | */ | ||
482 | if (asoc->peer.primary_path != NULL && | ||
483 | asoc->peer.primary_path != transport) | ||
484 | changeover = 1 ; | ||
485 | |||
477 | asoc->peer.primary_path = transport; | 486 | asoc->peer.primary_path = transport; |
478 | 487 | ||
479 | /* Set a default msg_name for events. */ | 488 | /* Set a default msg_name for events. */ |
@@ -499,12 +508,12 @@ void sctp_assoc_set_primary(struct sctp_association *asoc, | |||
499 | * double switch to the same destination address. | 508 | * double switch to the same destination address. |
500 | */ | 509 | */ |
501 | if (transport->cacc.changeover_active) | 510 | if (transport->cacc.changeover_active) |
502 | transport->cacc.cycling_changeover = 1; | 511 | transport->cacc.cycling_changeover = changeover; |
503 | 512 | ||
504 | /* 2) The sender MUST set CHANGEOVER_ACTIVE to indicate that | 513 | /* 2) The sender MUST set CHANGEOVER_ACTIVE to indicate that |
505 | * a changeover has occurred. | 514 | * a changeover has occurred. |
506 | */ | 515 | */ |
507 | transport->cacc.changeover_active = 1; | 516 | transport->cacc.changeover_active = changeover; |
508 | 517 | ||
509 | /* 3) The sender MUST store the next TSN to be sent in | 518 | /* 3) The sender MUST store the next TSN to be sent in |
510 | * next_tsn_at_change. | 519 | * next_tsn_at_change. |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index b435a193c5df..9258dfe784ae 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -108,14 +108,23 @@ static __init int sctp_proc_init(void) | |||
108 | } | 108 | } |
109 | 109 | ||
110 | if (sctp_snmp_proc_init()) | 110 | if (sctp_snmp_proc_init()) |
111 | goto out_nomem; | 111 | goto out_snmp_proc_init; |
112 | if (sctp_eps_proc_init()) | 112 | if (sctp_eps_proc_init()) |
113 | goto out_nomem; | 113 | goto out_eps_proc_init; |
114 | if (sctp_assocs_proc_init()) | 114 | if (sctp_assocs_proc_init()) |
115 | goto out_nomem; | 115 | goto out_assocs_proc_init; |
116 | 116 | ||
117 | return 0; | 117 | return 0; |
118 | 118 | ||
119 | out_assocs_proc_init: | ||
120 | sctp_eps_proc_exit(); | ||
121 | out_eps_proc_init: | ||
122 | sctp_snmp_proc_exit(); | ||
123 | out_snmp_proc_init: | ||
124 | if (proc_net_sctp) { | ||
125 | proc_net_sctp = NULL; | ||
126 | remove_proc_entry("sctp", init_net.proc_net); | ||
127 | } | ||
119 | out_nomem: | 128 | out_nomem: |
120 | return -ENOMEM; | 129 | return -ENOMEM; |
121 | } | 130 | } |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index e7e3baf7009e..0dbcde6758ea 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -4401,7 +4401,9 @@ static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len, | |||
4401 | if (copy_from_user(&getaddrs, optval, len)) | 4401 | if (copy_from_user(&getaddrs, optval, len)) |
4402 | return -EFAULT; | 4402 | return -EFAULT; |
4403 | 4403 | ||
4404 | if (getaddrs.addr_num <= 0) return -EINVAL; | 4404 | if (getaddrs.addr_num <= 0 || |
4405 | getaddrs.addr_num >= (INT_MAX / sizeof(union sctp_addr))) | ||
4406 | return -EINVAL; | ||
4405 | /* | 4407 | /* |
4406 | * For UDP-style sockets, id specifies the association to query. | 4408 | * For UDP-style sockets, id specifies the association to query. |
4407 | * If the id field is set to the value '0' then the locally bound | 4409 | * If the id field is set to the value '0' then the locally bound |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index e18cd3628db4..657835f227d3 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -169,6 +169,11 @@ static inline int unix_may_send(struct sock *sk, struct sock *osk) | |||
169 | return (unix_peer(osk) == NULL || unix_our_peer(sk, osk)); | 169 | return (unix_peer(osk) == NULL || unix_our_peer(sk, osk)); |
170 | } | 170 | } |
171 | 171 | ||
172 | static inline int unix_recvq_full(struct sock const *sk) | ||
173 | { | ||
174 | return skb_queue_len(&sk->sk_receive_queue) > sk->sk_max_ack_backlog; | ||
175 | } | ||
176 | |||
172 | static struct sock *unix_peer_get(struct sock *s) | 177 | static struct sock *unix_peer_get(struct sock *s) |
173 | { | 178 | { |
174 | struct sock *peer; | 179 | struct sock *peer; |
@@ -482,6 +487,8 @@ static int unix_socketpair(struct socket *, struct socket *); | |||
482 | static int unix_accept(struct socket *, struct socket *, int); | 487 | static int unix_accept(struct socket *, struct socket *, int); |
483 | static int unix_getname(struct socket *, struct sockaddr *, int *, int); | 488 | static int unix_getname(struct socket *, struct sockaddr *, int *, int); |
484 | static unsigned int unix_poll(struct file *, struct socket *, poll_table *); | 489 | static unsigned int unix_poll(struct file *, struct socket *, poll_table *); |
490 | static unsigned int unix_datagram_poll(struct file *, struct socket *, | ||
491 | poll_table *); | ||
485 | static int unix_ioctl(struct socket *, unsigned int, unsigned long); | 492 | static int unix_ioctl(struct socket *, unsigned int, unsigned long); |
486 | static int unix_shutdown(struct socket *, int); | 493 | static int unix_shutdown(struct socket *, int); |
487 | static int unix_stream_sendmsg(struct kiocb *, struct socket *, | 494 | static int unix_stream_sendmsg(struct kiocb *, struct socket *, |
@@ -527,7 +534,7 @@ static const struct proto_ops unix_dgram_ops = { | |||
527 | .socketpair = unix_socketpair, | 534 | .socketpair = unix_socketpair, |
528 | .accept = sock_no_accept, | 535 | .accept = sock_no_accept, |
529 | .getname = unix_getname, | 536 | .getname = unix_getname, |
530 | .poll = datagram_poll, | 537 | .poll = unix_datagram_poll, |
531 | .ioctl = unix_ioctl, | 538 | .ioctl = unix_ioctl, |
532 | .listen = sock_no_listen, | 539 | .listen = sock_no_listen, |
533 | .shutdown = unix_shutdown, | 540 | .shutdown = unix_shutdown, |
@@ -548,7 +555,7 @@ static const struct proto_ops unix_seqpacket_ops = { | |||
548 | .socketpair = unix_socketpair, | 555 | .socketpair = unix_socketpair, |
549 | .accept = unix_accept, | 556 | .accept = unix_accept, |
550 | .getname = unix_getname, | 557 | .getname = unix_getname, |
551 | .poll = datagram_poll, | 558 | .poll = unix_datagram_poll, |
552 | .ioctl = unix_ioctl, | 559 | .ioctl = unix_ioctl, |
553 | .listen = unix_listen, | 560 | .listen = unix_listen, |
554 | .shutdown = unix_shutdown, | 561 | .shutdown = unix_shutdown, |
@@ -983,8 +990,7 @@ static long unix_wait_for_peer(struct sock *other, long timeo) | |||
983 | 990 | ||
984 | sched = !sock_flag(other, SOCK_DEAD) && | 991 | sched = !sock_flag(other, SOCK_DEAD) && |
985 | !(other->sk_shutdown & RCV_SHUTDOWN) && | 992 | !(other->sk_shutdown & RCV_SHUTDOWN) && |
986 | (skb_queue_len(&other->sk_receive_queue) > | 993 | unix_recvq_full(other); |
987 | other->sk_max_ack_backlog); | ||
988 | 994 | ||
989 | unix_state_unlock(other); | 995 | unix_state_unlock(other); |
990 | 996 | ||
@@ -1058,8 +1064,7 @@ restart: | |||
1058 | if (other->sk_state != TCP_LISTEN) | 1064 | if (other->sk_state != TCP_LISTEN) |
1059 | goto out_unlock; | 1065 | goto out_unlock; |
1060 | 1066 | ||
1061 | if (skb_queue_len(&other->sk_receive_queue) > | 1067 | if (unix_recvq_full(other)) { |
1062 | other->sk_max_ack_backlog) { | ||
1063 | err = -EAGAIN; | 1068 | err = -EAGAIN; |
1064 | if (!timeo) | 1069 | if (!timeo) |
1065 | goto out_unlock; | 1070 | goto out_unlock; |
@@ -1428,9 +1433,7 @@ restart: | |||
1428 | goto out_unlock; | 1433 | goto out_unlock; |
1429 | } | 1434 | } |
1430 | 1435 | ||
1431 | if (unix_peer(other) != sk && | 1436 | if (unix_peer(other) != sk && unix_recvq_full(other)) { |
1432 | (skb_queue_len(&other->sk_receive_queue) > | ||
1433 | other->sk_max_ack_backlog)) { | ||
1434 | if (!timeo) { | 1437 | if (!timeo) { |
1435 | err = -EAGAIN; | 1438 | err = -EAGAIN; |
1436 | goto out_unlock; | 1439 | goto out_unlock; |
@@ -1991,6 +1994,64 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl | |||
1991 | return mask; | 1994 | return mask; |
1992 | } | 1995 | } |
1993 | 1996 | ||
1997 | static unsigned int unix_datagram_poll(struct file *file, struct socket *sock, | ||
1998 | poll_table *wait) | ||
1999 | { | ||
2000 | struct sock *sk = sock->sk, *peer; | ||
2001 | unsigned int mask; | ||
2002 | |||
2003 | poll_wait(file, sk->sk_sleep, wait); | ||
2004 | |||
2005 | peer = unix_peer_get(sk); | ||
2006 | if (peer) { | ||
2007 | if (peer != sk) { | ||
2008 | /* | ||
2009 | * Writability of a connected socket additionally | ||
2010 | * depends on the state of the receive queue of the | ||
2011 | * peer. | ||
2012 | */ | ||
2013 | poll_wait(file, &unix_sk(peer)->peer_wait, wait); | ||
2014 | } else { | ||
2015 | sock_put(peer); | ||
2016 | peer = NULL; | ||
2017 | } | ||
2018 | } | ||
2019 | |||
2020 | mask = 0; | ||
2021 | |||
2022 | /* exceptional events? */ | ||
2023 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) | ||
2024 | mask |= POLLERR; | ||
2025 | if (sk->sk_shutdown & RCV_SHUTDOWN) | ||
2026 | mask |= POLLRDHUP; | ||
2027 | if (sk->sk_shutdown == SHUTDOWN_MASK) | ||
2028 | mask |= POLLHUP; | ||
2029 | |||
2030 | /* readable? */ | ||
2031 | if (!skb_queue_empty(&sk->sk_receive_queue) || | ||
2032 | (sk->sk_shutdown & RCV_SHUTDOWN)) | ||
2033 | mask |= POLLIN | POLLRDNORM; | ||
2034 | |||
2035 | /* Connection-based need to check for termination and startup */ | ||
2036 | if (sk->sk_type == SOCK_SEQPACKET) { | ||
2037 | if (sk->sk_state == TCP_CLOSE) | ||
2038 | mask |= POLLHUP; | ||
2039 | /* connection hasn't started yet? */ | ||
2040 | if (sk->sk_state == TCP_SYN_SENT) | ||
2041 | return mask; | ||
2042 | } | ||
2043 | |||
2044 | /* writable? */ | ||
2045 | if (unix_writable(sk) && !(peer && unix_recvq_full(peer))) | ||
2046 | mask |= POLLOUT | POLLWRNORM | POLLWRBAND; | ||
2047 | else | ||
2048 | set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); | ||
2049 | |||
2050 | if (peer) | ||
2051 | sock_put(peer); | ||
2052 | |||
2053 | return mask; | ||
2054 | } | ||
1994 | 2055 | ||
1995 | #ifdef CONFIG_PROC_FS | 2056 | #ifdef CONFIG_PROC_FS |
1996 | static struct sock *first_unix_socket(int *i) | 2057 | static struct sock *first_unix_socket(int *i) |