diff options
Diffstat (limited to 'net/ipv4')
| -rw-r--r-- | net/ipv4/fib_lookup.h | 5 | ||||
| -rw-r--r-- | net/ipv4/fib_trie.c | 2 | ||||
| -rw-r--r-- | net/ipv4/icmp.c | 3 | ||||
| -rw-r--r-- | net/ipv4/igmp.c | 4 | ||||
| -rw-r--r-- | net/ipv4/inet_diag.c | 27 | ||||
| -rw-r--r-- | net/ipv4/netfilter/arp_tables.c | 1 | ||||
| -rw-r--r-- | net/ipv4/netfilter/ip_tables.c | 1 | ||||
| -rw-r--r-- | net/ipv4/netfilter/nf_nat_core.c | 40 | ||||
| -rw-r--r-- | net/ipv4/proc.c | 8 | ||||
| -rw-r--r-- | net/ipv4/sysctl_net_ipv4.c | 5 | ||||
| -rw-r--r-- | net/ipv4/tcp.c | 6 | ||||
| -rw-r--r-- | net/ipv4/tcp_input.c | 11 | ||||
| -rw-r--r-- | net/ipv4/tcp_ipv4.c | 8 | ||||
| -rw-r--r-- | net/ipv4/udp.c | 4 |
14 files changed, 65 insertions, 60 deletions
diff --git a/net/ipv4/fib_lookup.h b/net/ipv4/fib_lookup.h index a29edf2219c8..c079cc0ec651 100644 --- a/net/ipv4/fib_lookup.h +++ b/net/ipv4/fib_lookup.h | |||
| @@ -47,11 +47,8 @@ extern int fib_detect_death(struct fib_info *fi, int order, | |||
| 47 | static inline void fib_result_assign(struct fib_result *res, | 47 | static inline void fib_result_assign(struct fib_result *res, |
| 48 | struct fib_info *fi) | 48 | struct fib_info *fi) |
| 49 | { | 49 | { |
| 50 | if (res->fi != NULL) | 50 | /* we used to play games with refcounts, but we now use RCU */ |
| 51 | fib_info_put(res->fi); | ||
| 52 | res->fi = fi; | 51 | res->fi = fi; |
| 53 | if (fi != NULL) | ||
| 54 | atomic_inc(&fi->fib_clntref); | ||
| 55 | } | 52 | } |
| 56 | 53 | ||
| 57 | #endif /* _FIB_LOOKUP_H */ | 54 | #endif /* _FIB_LOOKUP_H */ |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 200eb538fbb3..0f280348e0fd 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
| @@ -365,7 +365,7 @@ static struct tnode *tnode_alloc(size_t size) | |||
| 365 | if (size <= PAGE_SIZE) | 365 | if (size <= PAGE_SIZE) |
| 366 | return kzalloc(size, GFP_KERNEL); | 366 | return kzalloc(size, GFP_KERNEL); |
| 367 | else | 367 | else |
| 368 | return __vmalloc(size, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); | 368 | return vzalloc(size); |
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | static void __tnode_vfree(struct work_struct *arg) | 371 | static void __tnode_vfree(struct work_struct *arg) |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 96bc7f9475a3..e5d1a44bcbdf 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
| @@ -569,6 +569,9 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) | |||
| 569 | /* No need to clone since we're just using its address. */ | 569 | /* No need to clone since we're just using its address. */ |
| 570 | rt2 = rt; | 570 | rt2 = rt; |
| 571 | 571 | ||
| 572 | if (!fl.nl_u.ip4_u.saddr) | ||
| 573 | fl.nl_u.ip4_u.saddr = rt->rt_src; | ||
| 574 | |||
| 572 | err = xfrm_lookup(net, (struct dst_entry **)&rt, &fl, NULL, 0); | 575 | err = xfrm_lookup(net, (struct dst_entry **)&rt, &fl, NULL, 0); |
| 573 | switch (err) { | 576 | switch (err) { |
| 574 | case 0: | 577 | case 0: |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index c8877c6c7216..3c53c2d89e3b 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
| @@ -2306,10 +2306,8 @@ void ip_mc_drop_socket(struct sock *sk) | |||
| 2306 | 2306 | ||
| 2307 | in_dev = inetdev_by_index(net, iml->multi.imr_ifindex); | 2307 | in_dev = inetdev_by_index(net, iml->multi.imr_ifindex); |
| 2308 | (void) ip_mc_leave_src(sk, iml, in_dev); | 2308 | (void) ip_mc_leave_src(sk, iml, in_dev); |
| 2309 | if (in_dev != NULL) { | 2309 | if (in_dev != NULL) |
| 2310 | ip_mc_dec_group(in_dev, iml->multi.imr_multiaddr.s_addr); | 2310 | ip_mc_dec_group(in_dev, iml->multi.imr_multiaddr.s_addr); |
| 2311 | in_dev_put(in_dev); | ||
| 2312 | } | ||
| 2313 | /* decrease mem now to avoid the memleak warning */ | 2311 | /* decrease mem now to avoid the memleak warning */ |
| 2314 | atomic_sub(sizeof(*iml), &sk->sk_omem_alloc); | 2312 | atomic_sub(sizeof(*iml), &sk->sk_omem_alloc); |
| 2315 | call_rcu(&iml->rcu, ip_mc_socklist_reclaim); | 2313 | call_rcu(&iml->rcu, ip_mc_socklist_reclaim); |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index ba8042665849..2ada17129fce 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
| @@ -490,9 +490,11 @@ static int inet_csk_diag_dump(struct sock *sk, | |||
| 490 | { | 490 | { |
| 491 | struct inet_diag_req *r = NLMSG_DATA(cb->nlh); | 491 | struct inet_diag_req *r = NLMSG_DATA(cb->nlh); |
| 492 | 492 | ||
| 493 | if (cb->nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(*r))) { | 493 | if (nlmsg_attrlen(cb->nlh, sizeof(*r))) { |
| 494 | struct inet_diag_entry entry; | 494 | struct inet_diag_entry entry; |
| 495 | struct rtattr *bc = (struct rtattr *)(r + 1); | 495 | const struct nlattr *bc = nlmsg_find_attr(cb->nlh, |
| 496 | sizeof(*r), | ||
| 497 | INET_DIAG_REQ_BYTECODE); | ||
| 496 | struct inet_sock *inet = inet_sk(sk); | 498 | struct inet_sock *inet = inet_sk(sk); |
| 497 | 499 | ||
| 498 | entry.family = sk->sk_family; | 500 | entry.family = sk->sk_family; |
| @@ -512,7 +514,7 @@ static int inet_csk_diag_dump(struct sock *sk, | |||
| 512 | entry.dport = ntohs(inet->inet_dport); | 514 | entry.dport = ntohs(inet->inet_dport); |
| 513 | entry.userlocks = sk->sk_userlocks; | 515 | entry.userlocks = sk->sk_userlocks; |
| 514 | 516 | ||
| 515 | if (!inet_diag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry)) | 517 | if (!inet_diag_bc_run(nla_data(bc), nla_len(bc), &entry)) |
| 516 | return 0; | 518 | return 0; |
| 517 | } | 519 | } |
| 518 | 520 | ||
| @@ -527,9 +529,11 @@ static int inet_twsk_diag_dump(struct inet_timewait_sock *tw, | |||
| 527 | { | 529 | { |
| 528 | struct inet_diag_req *r = NLMSG_DATA(cb->nlh); | 530 | struct inet_diag_req *r = NLMSG_DATA(cb->nlh); |
| 529 | 531 | ||
| 530 | if (cb->nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(*r))) { | 532 | if (nlmsg_attrlen(cb->nlh, sizeof(*r))) { |
| 531 | struct inet_diag_entry entry; | 533 | struct inet_diag_entry entry; |
| 532 | struct rtattr *bc = (struct rtattr *)(r + 1); | 534 | const struct nlattr *bc = nlmsg_find_attr(cb->nlh, |
| 535 | sizeof(*r), | ||
| 536 | INET_DIAG_REQ_BYTECODE); | ||
| 533 | 537 | ||
| 534 | entry.family = tw->tw_family; | 538 | entry.family = tw->tw_family; |
| 535 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 539 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
| @@ -548,7 +552,7 @@ static int inet_twsk_diag_dump(struct inet_timewait_sock *tw, | |||
| 548 | entry.dport = ntohs(tw->tw_dport); | 552 | entry.dport = ntohs(tw->tw_dport); |
| 549 | entry.userlocks = 0; | 553 | entry.userlocks = 0; |
| 550 | 554 | ||
| 551 | if (!inet_diag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), &entry)) | 555 | if (!inet_diag_bc_run(nla_data(bc), nla_len(bc), &entry)) |
| 552 | return 0; | 556 | return 0; |
| 553 | } | 557 | } |
| 554 | 558 | ||
| @@ -618,7 +622,7 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, | |||
| 618 | struct inet_diag_req *r = NLMSG_DATA(cb->nlh); | 622 | struct inet_diag_req *r = NLMSG_DATA(cb->nlh); |
| 619 | struct inet_connection_sock *icsk = inet_csk(sk); | 623 | struct inet_connection_sock *icsk = inet_csk(sk); |
| 620 | struct listen_sock *lopt; | 624 | struct listen_sock *lopt; |
| 621 | struct rtattr *bc = NULL; | 625 | const struct nlattr *bc = NULL; |
| 622 | struct inet_sock *inet = inet_sk(sk); | 626 | struct inet_sock *inet = inet_sk(sk); |
| 623 | int j, s_j; | 627 | int j, s_j; |
| 624 | int reqnum, s_reqnum; | 628 | int reqnum, s_reqnum; |
| @@ -638,8 +642,9 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, | |||
| 638 | if (!lopt || !lopt->qlen) | 642 | if (!lopt || !lopt->qlen) |
| 639 | goto out; | 643 | goto out; |
| 640 | 644 | ||
| 641 | if (cb->nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(*r))) { | 645 | if (nlmsg_attrlen(cb->nlh, sizeof(*r))) { |
| 642 | bc = (struct rtattr *)(r + 1); | 646 | bc = nlmsg_find_attr(cb->nlh, sizeof(*r), |
| 647 | INET_DIAG_REQ_BYTECODE); | ||
| 643 | entry.sport = inet->inet_num; | 648 | entry.sport = inet->inet_num; |
| 644 | entry.userlocks = sk->sk_userlocks; | 649 | entry.userlocks = sk->sk_userlocks; |
| 645 | } | 650 | } |
| @@ -672,8 +677,8 @@ static int inet_diag_dump_reqs(struct sk_buff *skb, struct sock *sk, | |||
| 672 | &ireq->rmt_addr; | 677 | &ireq->rmt_addr; |
| 673 | entry.dport = ntohs(ireq->rmt_port); | 678 | entry.dport = ntohs(ireq->rmt_port); |
| 674 | 679 | ||
| 675 | if (!inet_diag_bc_run(RTA_DATA(bc), | 680 | if (!inet_diag_bc_run(nla_data(bc), |
| 676 | RTA_PAYLOAD(bc), &entry)) | 681 | nla_len(bc), &entry)) |
| 677 | continue; | 682 | continue; |
| 678 | } | 683 | } |
| 679 | 684 | ||
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 3cad2591ace0..3fac340a28d5 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
| @@ -927,6 +927,7 @@ static int get_info(struct net *net, void __user *user, | |||
| 927 | private = &tmp; | 927 | private = &tmp; |
| 928 | } | 928 | } |
| 929 | #endif | 929 | #endif |
| 930 | memset(&info, 0, sizeof(info)); | ||
| 930 | info.valid_hooks = t->valid_hooks; | 931 | info.valid_hooks = t->valid_hooks; |
| 931 | memcpy(info.hook_entry, private->hook_entry, | 932 | memcpy(info.hook_entry, private->hook_entry, |
| 932 | sizeof(info.hook_entry)); | 933 | sizeof(info.hook_entry)); |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index d31b007a6d80..a846d633b3b6 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
| @@ -1124,6 +1124,7 @@ static int get_info(struct net *net, void __user *user, | |||
| 1124 | private = &tmp; | 1124 | private = &tmp; |
| 1125 | } | 1125 | } |
| 1126 | #endif | 1126 | #endif |
| 1127 | memset(&info, 0, sizeof(info)); | ||
| 1127 | info.valid_hooks = t->valid_hooks; | 1128 | info.valid_hooks = t->valid_hooks; |
| 1128 | memcpy(info.hook_entry, private->hook_entry, | 1129 | memcpy(info.hook_entry, private->hook_entry, |
| 1129 | sizeof(info.hook_entry)); | 1130 | sizeof(info.hook_entry)); |
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index 295c97431e43..c04787ce1a71 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c | |||
| @@ -47,26 +47,6 @@ __nf_nat_proto_find(u_int8_t protonum) | |||
| 47 | return rcu_dereference(nf_nat_protos[protonum]); | 47 | return rcu_dereference(nf_nat_protos[protonum]); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | static const struct nf_nat_protocol * | ||
| 51 | nf_nat_proto_find_get(u_int8_t protonum) | ||
| 52 | { | ||
| 53 | const struct nf_nat_protocol *p; | ||
| 54 | |||
| 55 | rcu_read_lock(); | ||
| 56 | p = __nf_nat_proto_find(protonum); | ||
| 57 | if (!try_module_get(p->me)) | ||
| 58 | p = &nf_nat_unknown_protocol; | ||
| 59 | rcu_read_unlock(); | ||
| 60 | |||
| 61 | return p; | ||
| 62 | } | ||
| 63 | |||
| 64 | static void | ||
| 65 | nf_nat_proto_put(const struct nf_nat_protocol *p) | ||
| 66 | { | ||
| 67 | module_put(p->me); | ||
| 68 | } | ||
| 69 | |||
| 70 | /* We keep an extra hash for each conntrack, for fast searching. */ | 50 | /* We keep an extra hash for each conntrack, for fast searching. */ |
| 71 | static inline unsigned int | 51 | static inline unsigned int |
| 72 | hash_by_src(const struct net *net, u16 zone, | 52 | hash_by_src(const struct net *net, u16 zone, |
| @@ -588,6 +568,26 @@ static struct nf_ct_ext_type nat_extend __read_mostly = { | |||
| 588 | #include <linux/netfilter/nfnetlink.h> | 568 | #include <linux/netfilter/nfnetlink.h> |
| 589 | #include <linux/netfilter/nfnetlink_conntrack.h> | 569 | #include <linux/netfilter/nfnetlink_conntrack.h> |
| 590 | 570 | ||
| 571 | static const struct nf_nat_protocol * | ||
| 572 | nf_nat_proto_find_get(u_int8_t protonum) | ||
| 573 | { | ||
| 574 | const struct nf_nat_protocol *p; | ||
| 575 | |||
| 576 | rcu_read_lock(); | ||
| 577 | p = __nf_nat_proto_find(protonum); | ||
| 578 | if (!try_module_get(p->me)) | ||
| 579 | p = &nf_nat_unknown_protocol; | ||
| 580 | rcu_read_unlock(); | ||
| 581 | |||
| 582 | return p; | ||
| 583 | } | ||
| 584 | |||
| 585 | static void | ||
| 586 | nf_nat_proto_put(const struct nf_nat_protocol *p) | ||
| 587 | { | ||
| 588 | module_put(p->me); | ||
| 589 | } | ||
| 590 | |||
| 591 | static const struct nla_policy protonat_nla_policy[CTA_PROTONAT_MAX+1] = { | 591 | static const struct nla_policy protonat_nla_policy[CTA_PROTONAT_MAX+1] = { |
| 592 | [CTA_PROTONAT_PORT_MIN] = { .type = NLA_U16 }, | 592 | [CTA_PROTONAT_PORT_MIN] = { .type = NLA_U16 }, |
| 593 | [CTA_PROTONAT_PORT_MAX] = { .type = NLA_U16 }, | 593 | [CTA_PROTONAT_PORT_MAX] = { .type = NLA_U16 }, |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 4ae1f203f7cb..1b48eb1ed453 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
| @@ -59,13 +59,13 @@ static int sockstat_seq_show(struct seq_file *seq, void *v) | |||
| 59 | local_bh_enable(); | 59 | local_bh_enable(); |
| 60 | 60 | ||
| 61 | socket_seq_show(seq); | 61 | socket_seq_show(seq); |
| 62 | seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %d\n", | 62 | seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %ld\n", |
| 63 | sock_prot_inuse_get(net, &tcp_prot), orphans, | 63 | sock_prot_inuse_get(net, &tcp_prot), orphans, |
| 64 | tcp_death_row.tw_count, sockets, | 64 | tcp_death_row.tw_count, sockets, |
| 65 | atomic_read(&tcp_memory_allocated)); | 65 | atomic_long_read(&tcp_memory_allocated)); |
| 66 | seq_printf(seq, "UDP: inuse %d mem %d\n", | 66 | seq_printf(seq, "UDP: inuse %d mem %ld\n", |
| 67 | sock_prot_inuse_get(net, &udp_prot), | 67 | sock_prot_inuse_get(net, &udp_prot), |
| 68 | atomic_read(&udp_memory_allocated)); | 68 | atomic_long_read(&udp_memory_allocated)); |
| 69 | seq_printf(seq, "UDPLITE: inuse %d\n", | 69 | seq_printf(seq, "UDPLITE: inuse %d\n", |
| 70 | sock_prot_inuse_get(net, &udplite_prot)); | 70 | sock_prot_inuse_get(net, &udplite_prot)); |
| 71 | seq_printf(seq, "RAW: inuse %d\n", | 71 | seq_printf(seq, "RAW: inuse %d\n", |
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index d96c1da4b17c..e91911d7aae2 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
| @@ -398,7 +398,7 @@ static struct ctl_table ipv4_table[] = { | |||
| 398 | .data = &sysctl_tcp_mem, | 398 | .data = &sysctl_tcp_mem, |
| 399 | .maxlen = sizeof(sysctl_tcp_mem), | 399 | .maxlen = sizeof(sysctl_tcp_mem), |
| 400 | .mode = 0644, | 400 | .mode = 0644, |
| 401 | .proc_handler = proc_dointvec | 401 | .proc_handler = proc_doulongvec_minmax |
| 402 | }, | 402 | }, |
| 403 | { | 403 | { |
| 404 | .procname = "tcp_wmem", | 404 | .procname = "tcp_wmem", |
| @@ -602,8 +602,7 @@ static struct ctl_table ipv4_table[] = { | |||
| 602 | .data = &sysctl_udp_mem, | 602 | .data = &sysctl_udp_mem, |
| 603 | .maxlen = sizeof(sysctl_udp_mem), | 603 | .maxlen = sizeof(sysctl_udp_mem), |
| 604 | .mode = 0644, | 604 | .mode = 0644, |
| 605 | .proc_handler = proc_dointvec_minmax, | 605 | .proc_handler = proc_doulongvec_minmax, |
| 606 | .extra1 = &zero | ||
| 607 | }, | 606 | }, |
| 608 | { | 607 | { |
| 609 | .procname = "udp_rmem_min", | 608 | .procname = "udp_rmem_min", |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 1664a0590bb8..081419969485 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
| @@ -282,7 +282,7 @@ int sysctl_tcp_fin_timeout __read_mostly = TCP_FIN_TIMEOUT; | |||
| 282 | struct percpu_counter tcp_orphan_count; | 282 | struct percpu_counter tcp_orphan_count; |
| 283 | EXPORT_SYMBOL_GPL(tcp_orphan_count); | 283 | EXPORT_SYMBOL_GPL(tcp_orphan_count); |
| 284 | 284 | ||
| 285 | int sysctl_tcp_mem[3] __read_mostly; | 285 | long sysctl_tcp_mem[3] __read_mostly; |
| 286 | int sysctl_tcp_wmem[3] __read_mostly; | 286 | int sysctl_tcp_wmem[3] __read_mostly; |
| 287 | int sysctl_tcp_rmem[3] __read_mostly; | 287 | int sysctl_tcp_rmem[3] __read_mostly; |
| 288 | 288 | ||
| @@ -290,7 +290,7 @@ EXPORT_SYMBOL(sysctl_tcp_mem); | |||
| 290 | EXPORT_SYMBOL(sysctl_tcp_rmem); | 290 | EXPORT_SYMBOL(sysctl_tcp_rmem); |
| 291 | EXPORT_SYMBOL(sysctl_tcp_wmem); | 291 | EXPORT_SYMBOL(sysctl_tcp_wmem); |
| 292 | 292 | ||
| 293 | atomic_t tcp_memory_allocated; /* Current allocated memory. */ | 293 | atomic_long_t tcp_memory_allocated; /* Current allocated memory. */ |
| 294 | EXPORT_SYMBOL(tcp_memory_allocated); | 294 | EXPORT_SYMBOL(tcp_memory_allocated); |
| 295 | 295 | ||
| 296 | /* | 296 | /* |
| @@ -2246,7 +2246,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level, | |||
| 2246 | /* Values greater than interface MTU won't take effect. However | 2246 | /* Values greater than interface MTU won't take effect. However |
| 2247 | * at the point when this call is done we typically don't yet | 2247 | * at the point when this call is done we typically don't yet |
| 2248 | * know which interface is going to be used */ | 2248 | * know which interface is going to be used */ |
| 2249 | if (val < 8 || val > MAX_TCP_WINDOW) { | 2249 | if (val < 64 || val > MAX_TCP_WINDOW) { |
| 2250 | err = -EINVAL; | 2250 | err = -EINVAL; |
| 2251 | break; | 2251 | break; |
| 2252 | } | 2252 | } |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 3357f69e353d..6d8ab1c4efc3 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
| @@ -259,8 +259,11 @@ static void tcp_fixup_sndbuf(struct sock *sk) | |||
| 259 | int sndmem = tcp_sk(sk)->rx_opt.mss_clamp + MAX_TCP_HEADER + 16 + | 259 | int sndmem = tcp_sk(sk)->rx_opt.mss_clamp + MAX_TCP_HEADER + 16 + |
| 260 | sizeof(struct sk_buff); | 260 | sizeof(struct sk_buff); |
| 261 | 261 | ||
| 262 | if (sk->sk_sndbuf < 3 * sndmem) | 262 | if (sk->sk_sndbuf < 3 * sndmem) { |
| 263 | sk->sk_sndbuf = min(3 * sndmem, sysctl_tcp_wmem[2]); | 263 | sk->sk_sndbuf = 3 * sndmem; |
| 264 | if (sk->sk_sndbuf > sysctl_tcp_wmem[2]) | ||
| 265 | sk->sk_sndbuf = sysctl_tcp_wmem[2]; | ||
| 266 | } | ||
| 264 | } | 267 | } |
| 265 | 268 | ||
| 266 | /* 2. Tuning advertised window (window_clamp, rcv_ssthresh) | 269 | /* 2. Tuning advertised window (window_clamp, rcv_ssthresh) |
| @@ -396,7 +399,7 @@ static void tcp_clamp_window(struct sock *sk) | |||
| 396 | if (sk->sk_rcvbuf < sysctl_tcp_rmem[2] && | 399 | if (sk->sk_rcvbuf < sysctl_tcp_rmem[2] && |
| 397 | !(sk->sk_userlocks & SOCK_RCVBUF_LOCK) && | 400 | !(sk->sk_userlocks & SOCK_RCVBUF_LOCK) && |
| 398 | !tcp_memory_pressure && | 401 | !tcp_memory_pressure && |
| 399 | atomic_read(&tcp_memory_allocated) < sysctl_tcp_mem[0]) { | 402 | atomic_long_read(&tcp_memory_allocated) < sysctl_tcp_mem[0]) { |
| 400 | sk->sk_rcvbuf = min(atomic_read(&sk->sk_rmem_alloc), | 403 | sk->sk_rcvbuf = min(atomic_read(&sk->sk_rmem_alloc), |
| 401 | sysctl_tcp_rmem[2]); | 404 | sysctl_tcp_rmem[2]); |
| 402 | } | 405 | } |
| @@ -4861,7 +4864,7 @@ static int tcp_should_expand_sndbuf(struct sock *sk) | |||
| 4861 | return 0; | 4864 | return 0; |
| 4862 | 4865 | ||
| 4863 | /* If we are under soft global TCP memory pressure, do not expand. */ | 4866 | /* If we are under soft global TCP memory pressure, do not expand. */ |
| 4864 | if (atomic_read(&tcp_memory_allocated) >= sysctl_tcp_mem[0]) | 4867 | if (atomic_long_read(&tcp_memory_allocated) >= sysctl_tcp_mem[0]) |
| 4865 | return 0; | 4868 | return 0; |
| 4866 | 4869 | ||
| 4867 | /* If we filled the congestion window, do not expand. */ | 4870 | /* If we filled the congestion window, do not expand. */ |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 8f8527d41682..69ccbc1dde9c 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
| @@ -415,6 +415,9 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info) | |||
| 415 | !icsk->icsk_backoff) | 415 | !icsk->icsk_backoff) |
| 416 | break; | 416 | break; |
| 417 | 417 | ||
| 418 | if (sock_owned_by_user(sk)) | ||
| 419 | break; | ||
| 420 | |||
| 418 | icsk->icsk_backoff--; | 421 | icsk->icsk_backoff--; |
| 419 | inet_csk(sk)->icsk_rto = __tcp_set_rto(tp) << | 422 | inet_csk(sk)->icsk_rto = __tcp_set_rto(tp) << |
| 420 | icsk->icsk_backoff; | 423 | icsk->icsk_backoff; |
| @@ -429,11 +432,6 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info) | |||
| 429 | if (remaining) { | 432 | if (remaining) { |
| 430 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, | 433 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, |
| 431 | remaining, TCP_RTO_MAX); | 434 | remaining, TCP_RTO_MAX); |
| 432 | } else if (sock_owned_by_user(sk)) { | ||
| 433 | /* RTO revert clocked out retransmission, | ||
| 434 | * but socket is locked. Will defer. */ | ||
| 435 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, | ||
| 436 | HZ/20, TCP_RTO_MAX); | ||
| 437 | } else { | 435 | } else { |
| 438 | /* RTO revert clocked out retransmission. | 436 | /* RTO revert clocked out retransmission. |
| 439 | * Will retransmit now */ | 437 | * Will retransmit now */ |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 28cb2d733a3c..5e0a3a582a59 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
| @@ -110,7 +110,7 @@ | |||
| 110 | struct udp_table udp_table __read_mostly; | 110 | struct udp_table udp_table __read_mostly; |
| 111 | EXPORT_SYMBOL(udp_table); | 111 | EXPORT_SYMBOL(udp_table); |
| 112 | 112 | ||
| 113 | int sysctl_udp_mem[3] __read_mostly; | 113 | long sysctl_udp_mem[3] __read_mostly; |
| 114 | EXPORT_SYMBOL(sysctl_udp_mem); | 114 | EXPORT_SYMBOL(sysctl_udp_mem); |
| 115 | 115 | ||
| 116 | int sysctl_udp_rmem_min __read_mostly; | 116 | int sysctl_udp_rmem_min __read_mostly; |
| @@ -119,7 +119,7 @@ EXPORT_SYMBOL(sysctl_udp_rmem_min); | |||
| 119 | int sysctl_udp_wmem_min __read_mostly; | 119 | int sysctl_udp_wmem_min __read_mostly; |
| 120 | EXPORT_SYMBOL(sysctl_udp_wmem_min); | 120 | EXPORT_SYMBOL(sysctl_udp_wmem_min); |
| 121 | 121 | ||
| 122 | atomic_t udp_memory_allocated; | 122 | atomic_long_t udp_memory_allocated; |
| 123 | EXPORT_SYMBOL(udp_memory_allocated); | 123 | EXPORT_SYMBOL(udp_memory_allocated); |
| 124 | 124 | ||
| 125 | #define MAX_UDP_PORTS 65536 | 125 | #define MAX_UDP_PORTS 65536 |
