diff --git a/net/netfilter/nf_conntrack_core.c index a3ef8eae7..8a2cdd172 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -1517,6 +1517,7 @@ static void gc_worker(struct work_struct *work) struct conntrack_gc_work *gc_work; unsigned int expired_count = 0; unsigned long next_run; + unsigned int bucket_count = 0; s32 delta_time; long count; @@ -1617,6 +1618,7 @@ static void gc_worker(struct work_struct *work) */ rcu_read_unlock(); cond_resched(); + bucket_count++; i++; delta_time = nfct_time_stamp - end_time; @@ -1626,6 +1628,10 @@ static void gc_worker(struct work_struct *work) gc_work->next_bucket = i; next_run = 0; goto early_exit; + if (bucket_count > 10) { + gc_work->next_bucket = i; + goto early_exit; + } } } while (i < hashsz);