Skip to contentSkip to conversation

netfilter: xtables: add scheduling opportunity in get_counters

PATCH Applied Florian Westphal 3 participants 3 messages Sep 1, 2017 – Sep 8, 2017

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 net/ipv4/netfilter/arp_tables.c | 1 +
 net/ipv4/netfilter/ip_tables.c  | 1 +
 net/ipv6/netfilter/ip6_tables.c | 1 +
 3 files changed, 3 insertions(+)
net/ipv4/netfilter/arp_tables.c +1 -0
index 9e9d9afd18f7..14b20cf4cfd3 100644
@@ -629,6 +629,7 @@ static void get_counters(const struct xt_table_info *t,
 
 			ADD_COUNTER(counters[i], bcnt, pcnt);
 			++i;
+			cond_resched();
 		}
 	}
 }
net/ipv4/netfilter/ip_tables.c +1 -0
index 622ed2887cd5..92ef5a2ef0c3 100644
@@ -782,6 +782,7 @@ get_counters(const struct xt_table_info *t,
 
 			ADD_COUNTER(counters[i], bcnt, pcnt);
 			++i; /* macro does multi eval of i */
+			cond_resched();
 		}
 	}
 }
net/ipv6/netfilter/ip6_tables.c +1 -0
index 1f90644056ac..1e9c775dc3d6 100644
@@ -801,6 +801,7 @@ get_counters(const struct xt_table_info *t,
 
 			ADD_COUNTER(counters[i], bcnt, pcnt);
 			++i;
+			cond_resched();
 		}
 	}
 }
Signature · 1 line
2.13.0
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Florian Westphal

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.

---
 net/ipv4/netfilter/arp_tables.c | 1 +
 net/ipv4/netfilter/ip_tables.c  | 1 +
 net/ipv6/netfilter/ip6_tables.c | 1 +
 3 files changed, 3 insertions(+)

SGTM, thanks Florian !

maintainer Applied
#2 lore raw
In reply to Florian Westphal
Quoted 3 lines · Florian Westphal

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.

Applied, thanks.