aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/netfilter/nf_conntrack_core.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 355b330c214e..3e7c0a90003a 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -864,9 +864,14 @@ void __nf_ct_refresh_acct(struct nf_conn *ct,
864 ct->timeout.expires = extra_jiffies; 864 ct->timeout.expires = extra_jiffies;
865 event = IPCT_REFRESH; 865 event = IPCT_REFRESH;
866 } else { 866 } else {
867 /* Need del_timer for race avoidance (may already be dying). */ 867 unsigned long newtime = jiffies + extra_jiffies;
868 if (del_timer(&ct->timeout)) { 868
869 ct->timeout.expires = jiffies + extra_jiffies; 869 /* Only update the timeout if the new timeout is at least
870 HZ jiffies from the old timeout. Need del_timer for race
871 avoidance (may already be dying). */
872 if (newtime - ct->timeout.expires >= HZ
873 && del_timer(&ct->timeout)) {
874 ct->timeout.expires = newtime;
870 add_timer(&ct->timeout); 875 add_timer(&ct->timeout);
871 event = IPCT_REFRESH; 876 event = IPCT_REFRESH;
872 } 877 }