[NETFILTER]: Fix oops in conntrack event cache
authorHarald Welte <laforge@netfilter.org>
Sat, 17 Sep 2005 00:00:38 +0000 (17:00 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 17 Sep 2005 00:00:38 +0000 (17:00 -0700)
ip_ct_refresh_acct() can be called without a valid "skb" pointer.
This used to work, since ct_add_counters() deals with that fact.
However, the recently-added event cache doesn't handle this at all.

This patch is a quick fix that is supposed to be replaced soon by a cleaner
solution during the pending redesign of the event cache.

Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/netfilter/ip_conntrack_core.c

index 19cba16e6e1e587c5281a997ac67ec7fa291da8a..f8cd8e42961ef1f48c516dcdf4e051685745e902 100644 (file)
@@ -1143,7 +1143,10 @@ void ip_ct_refresh_acct(struct ip_conntrack *ct,
                if (del_timer(&ct->timeout)) {
                        ct->timeout.expires = jiffies + extra_jiffies;
                        add_timer(&ct->timeout);
-                       ip_conntrack_event_cache(IPCT_REFRESH, skb);
+                       /* FIXME: We loose some REFRESH events if this function
+                        * is called without an skb.  I'll fix this later -HW */
+                       if (skb)
+                               ip_conntrack_event_cache(IPCT_REFRESH, skb);
                }
                ct_add_counters(ct, ctinfo, skb);
                write_unlock_bh(&ip_conntrack_lock);