netfilter: x_tables: fix compat match/target pad out-of-bound write
authorFlorian Westphal <fw@strlen.de>
Wed, 7 Apr 2021 19:38:57 +0000 (21:38 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 12 Apr 2021 22:18:57 +0000 (00:18 +0200)
commitb29c457a6511435960115c0f548c4360d5f4801d
treea2cabc721228fc1d876374aac3bd7758d4016165
parentd163a925ebbc6eb5b562b0f1d72c7e817aa75c40
netfilter: x_tables: fix compat match/target pad out-of-bound write

xt_compat_match/target_from_user doesn't check that zeroing the area
to start of next rule won't write past end of allocated ruleset blob.

Remove this code and zero the entire blob beforehand.

Reported-by: syzbot+cfc0247ac173f597aaaa@syzkaller.appspotmail.com
Reported-by: Andy Nguyen <theflow@google.com>
Fixes: 9fa492cdc160c ("[NETFILTER]: x_tables: simplify compat API")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/ip_tables.c
net/ipv6/netfilter/ip6_tables.c
net/netfilter/x_tables.c