diff options
author | Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> | 2005-08-09 23:24:15 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-08-29 18:51:28 -0400 |
commit | 7663f18807805f02608457af8e2f59eee5d910fd (patch) | |
tree | f485ca844f9b854ea53a92263d4cfb533849ee86 /net | |
parent | 8a61fadb3908454ccfa538aaa75eb1d22def5700 (diff) |
[NETFILTER]: return ENOMEM when ip_conntrack_alloc() fails.
This patch fixes the bug which doesn't return ERR_PTR(-ENOMEM) if it
failed to allocate memory space from slab cache. This bug leads to
erroneously not dropped packets under stress, and wrong statistic
counters ('invalid' is incremented instead of 'drop'). It was
introduced during the ctnetlink merge in the net-2.6.14 tree, so no
stable or mainline releases affected.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_core.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c index 9261388d5ac2..285743bfbed3 100644 --- a/net/ipv4/netfilter/ip_conntrack_core.c +++ b/net/ipv4/netfilter/ip_conntrack_core.c | |||
@@ -655,7 +655,7 @@ struct ip_conntrack *ip_conntrack_alloc(struct ip_conntrack_tuple *orig, | |||
655 | conntrack = kmem_cache_alloc(ip_conntrack_cachep, GFP_ATOMIC); | 655 | conntrack = kmem_cache_alloc(ip_conntrack_cachep, GFP_ATOMIC); |
656 | if (!conntrack) { | 656 | if (!conntrack) { |
657 | DEBUGP("Can't allocate conntrack.\n"); | 657 | DEBUGP("Can't allocate conntrack.\n"); |
658 | return NULL; | 658 | return ERR_PTR(-ENOMEM); |
659 | } | 659 | } |
660 | 660 | ||
661 | memset(conntrack, 0, sizeof(*conntrack)); | 661 | memset(conntrack, 0, sizeof(*conntrack)); |
@@ -696,8 +696,9 @@ init_conntrack(struct ip_conntrack_tuple *tuple, | |||
696 | return NULL; | 696 | return NULL; |
697 | } | 697 | } |
698 | 698 | ||
699 | if (!(conntrack = ip_conntrack_alloc(tuple, &repl_tuple))) | 699 | conntrack = ip_conntrack_alloc(tuple, &repl_tuple); |
700 | return NULL; | 700 | if (conntrack == NULL || IS_ERR(conntrack)) |
701 | return (struct ip_conntrack_tuple_hash *)conntrack; | ||
701 | 702 | ||
702 | if (!protocol->new(conntrack, skb)) { | 703 | if (!protocol->new(conntrack, skb)) { |
703 | ip_conntrack_free(conntrack); | 704 | ip_conntrack_free(conntrack); |