Skip to content

Commit a5d7a71

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: xtables: add scheduling opportunity in get_counters
There are reports about spurious softlockups during iptables-restore, a backtrace i saw points at get_counters -- it uses a sequence lock and also has unbounded restart loop. Signed-off-by: Florian Westphal <[email protected]> Acked-by: Eric Dumazet <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 75c2631 commit a5d7a71

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

net/ipv4/netfilter/arp_tables.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ static void get_counters(const struct xt_table_info *t,
629629

630630
ADD_COUNTER(counters[i], bcnt, pcnt);
631631
++i;
632+
cond_resched();
632633
}
633634
}
634635
}

net/ipv4/netfilter/ip_tables.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ get_counters(const struct xt_table_info *t,
776776

777777
ADD_COUNTER(counters[i], bcnt, pcnt);
778778
++i; /* macro does multi eval of i */
779+
cond_resched();
779780
}
780781
}
781782
}

net/ipv6/netfilter/ip6_tables.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,7 @@ get_counters(const struct xt_table_info *t,
795795

796796
ADD_COUNTER(counters[i], bcnt, pcnt);
797797
++i;
798+
cond_resched();
798799
}
799800
}
800801
}

0 commit comments

Comments
 (0)