summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorCong Wang <xiyou.wangcong@gmail.com>2020-01-10 11:53:08 -0800
committerPablo Neira Ayuso <pablo@netfilter.org>2020-01-13 18:53:59 +0100
commitc120959387efa51479056fd01dc90adfba7a590c (patch)
tree383269c98a778495978a7e56e69962040e4cf600 /net
parentc9f53049d4a842db6bcd76f597759a0ef5f65c86 (diff)
downloadlinux-c120959387efa51479056fd01dc90adfba7a590c.tar.gz
linux-c120959387efa51479056fd01dc90adfba7a590c.tar.bz2
linux-c120959387efa51479056fd01dc90adfba7a590c.zip
netfilter: fix a use-after-free in mtype_destroy()
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>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/ipset/ip_set_bitmap_gen.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h b/net/netfilter/ipset/ip_set_bitmap_gen.h
index 1abd6f0dc227..077a2cb65fcb 100644
--- a/net/netfilter/ipset/ip_set_bitmap_gen.h
+++ b/net/netfilter/ipset/ip_set_bitmap_gen.h
@@ -60,9 +60,9 @@ mtype_destroy(struct ip_set *set)
if (SET_WITH_TIMEOUT(set))
del_timer_sync(&map->gc);
- ip_set_free(map->members);
if (set->dsize && set->extensions & IPSET_EXT_DESTROY)
mtype_ext_cleanup(set);
+ ip_set_free(map->members);
ip_set_free(map);
set->data = NULL;