netfilter: fix a use-after-free in mtype_destroy()
authorCong Wang <xiyou.wangcong@gmail.com>
Fri, 10 Jan 2020 19:53:08 +0000 (11:53 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Jan 2020 07:20:33 +0000 (08:20 +0100)
commit071b66b3808260ab35b725fc9f7e5466637a2b9e
tree237bf248c2d3793c881b5baeeec3263282df2737
parent99e739733fd2794ad9b27d99294061e756046ae2
netfilter: fix a use-after-free in mtype_destroy()

commit c120959387efa51479056fd01dc90adfba7a590c upstream.

map->members is freed by ip_set_free() right before using it in
mtype_ext_cleanup() again. So we just have to move it down.

Reported-by: syzbot+4c3cc6dbe7259dbf9054@syzkaller.appspotmail.com
Fixes: 40cd63bf33b2 ("netfilter: ipset: Support extensions which need a per data destroy function")
Acked-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/ipset/ip_set_bitmap_gen.h