netfilter: fix NULL ops dereference in iptable lazy init
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest2 patches 5 repliesIn review
- v12 patches 2 repliesSuperseded
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | netfilter: ip_tables: guard ipt_unregister_table_pre_exit against NULL opsnet/ | +1 | 5 replies | |
| 2/2 | netfilter: ip6_tables: guard ip6t_unregister_table_pre_exit against NULL opsnet/ | +1 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/2] netfilter: fix NULL ops dereference in iptable lazy init
v1 moved the ops allocation before xt_register_table(), but as Phil Sutter pointed out, new_table->ops is still assigned after the table becomes visible via list_add() inside xt_register_table(). The race window was reduced but not eliminated.
v2 takes a different approach: guard the pre_exit path against a NULL ops pointer. If cleanup_net races against lazy table init and finds the table before ops has been assigned, it simply skips the nf_unregister_net_hooks() call. The register path will either complete normally or fail and clean up via __ipt_unregister_table().
v1: https://lore.kernel.org/netdev/[email protected]/
Tristan Madani (2):
netfilter: ip_tables: guard ipt_unregister_table_pre_exit against NULL ops
netfilter: ip6_tables: guard ip6t_unregister_table_pre_exit against NULL ops
net/ipv4/netfilter/ip_tables.c | 2 +- net/ipv6/netfilter/ip6_tables.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)