mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
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: net/ipv4: Eliminate kstrdup memory leak net/caif/cfrfml.c: use asm/unaligned.h ax25: missplaced sock_put(sk) qlge: reset the chip before freeing the buffers l2tp: test for ethernet header in l2tp_eth_dev_recv() tcp: select(writefds) don't hang up when a peer close connection tcp: fix three tcp sysctls tuning tcp: Combat per-cpu skew in orphan tests. pxa168_eth: silence gcc warnings pxa168_eth: update call to phy_mii_ioctl() pxa168_eth: fix error handling in prope pxa168_eth: remove unneeded null check phylib: Fix race between returning phydev and calling adjust_link caif-driver: add HAS_DMA dependency 3c59x: Fix deadlock between boomerang_interrupt and boomerang_start_tx qlcnic: fix poll implementation netxen: fix poll implementation bridge: netfilter: fix a memory leak
This commit is contained in:
@@ -268,11 +268,21 @@ static inline int between(__u32 seq1, __u32 seq2, __u32 seq3)
|
||||
return seq3 - seq2 >= seq1 - seq2;
|
||||
}
|
||||
|
||||
static inline int tcp_too_many_orphans(struct sock *sk, int num)
|
||||
static inline bool tcp_too_many_orphans(struct sock *sk, int shift)
|
||||
{
|
||||
return (num > sysctl_tcp_max_orphans) ||
|
||||
(sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
|
||||
atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]);
|
||||
struct percpu_counter *ocp = sk->sk_prot->orphan_count;
|
||||
int orphans = percpu_counter_read_positive(ocp);
|
||||
|
||||
if (orphans << shift > sysctl_tcp_max_orphans) {
|
||||
orphans = percpu_counter_sum_positive(ocp);
|
||||
if (orphans << shift > sysctl_tcp_max_orphans)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
|
||||
atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2])
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* syncookies: remember time of last synqueue overflow */
|
||||
|
||||
Reference in New Issue
Block a user