[Devel] [PATCH RHEL7 COMMIT] ms/netfilter: fix a use-after-free in mtype_destroy()
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Jun 14 14:56:53 MSK 2024
The commit is pushed to "branch-rh7-3.10.0-1160.114.2.vz7.222.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.114.2.vz7.222.1
------>
commit 18318a617df8b012f4e662f5a1b5be741496955c
Author: Cong Wang <xiyou.wangcong at gmail.com>
Date: Fri Jan 10 11:53:08 2020 -0800
ms/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 at syzkaller.appspotmail.com
mFixes: 40cd63bf33b2 ("netfilter: ipset: Support extensions which need a per data destroy function")
Acked-by: Jozsef Kadlecsik <kadlec at netfilter.org>
Signed-off-by: Cong Wang <xiyou.wangcong at gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
Found (but does not fix it) in the scope of
https://virtuozzo.atlassian.net/browse/PSBM-155867
(cherry picked from commit c120959387efa51479056fd01dc90adfba7a590c)
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
net/netfilter/ipset/ip_set_bitmap_gen.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/ipset/ip_set_bitmap_gen.h b/net/netfilter/ipset/ip_set_bitmap_gen.h
index 257ca393e6f2..af480ffefaf3 100644
--- a/net/netfilter/ipset/ip_set_bitmap_gen.h
+++ b/net/netfilter/ipset/ip_set_bitmap_gen.h
@@ -64,9 +64,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;
More information about the Devel
mailing list