Hi, On Fri, 10 Jan 2020, Cong Wang wrote: > On Fri, Jan 10, 2020 at 10:44 AM syzbot > <syzbot+4c3cc6dbe7259dbf9054@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote: > > > > syzbot found the following crash on: > > > > HEAD commit: b07f636f Merge tag 'tpmdd-next-20200108' of git://git.infr.. > > git tree: upstream > > console output: https://syzkaller.appspot.com/x/log.txt?x=16c03259e00000 > > kernel config: https://syzkaller.appspot.com/x/.config?x=18698c0c240ba616 > > dashboard link: https://syzkaller.appspot.com/bug?extid=4c3cc6dbe7259dbf9054 > > compiler: gcc (GCC) 9.0.0 20181231 (experimental) > > userspace arch: i386 > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10c365c6e00000 > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=117df9e1e00000 > > > > The bug was bisected to: > > > > commit b9a1e627405d68d475a3c1f35e685ccfb5bbe668 > > Author: Cong Wang <xiyou.wangcong@xxxxxxxxx> > > Date: Thu Jul 4 00:21:13 2019 +0000 > > > > hsr: implement dellink to clean up resources > > > > bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=118759e1e00000 > > final crash: https://syzkaller.appspot.com/x/report.txt?x=138759e1e00000 > > console output: https://syzkaller.appspot.com/x/log.txt?x=158759e1e00000 > > > > IMPORTANT: if you fix the bug, please add the following tag to the commit: > > Reported-by: syzbot+4c3cc6dbe7259dbf9054@xxxxxxxxxxxxxxxxxxxxxxxxx > > Fixes: b9a1e627405d ("hsr: implement dellink to clean up resources") > > > > ================================================================== > > BUG: KASAN: use-after-free in test_bit > > include/asm-generic/bitops/instrumented-non-atomic.h:110 [inline] > > BUG: KASAN: use-after-free in bitmap_port_ext_cleanup+0xe6/0x2a0 > > net/netfilter/ipset/ip_set_bitmap_gen.h:51 > > Read of size 8 at addr ffff8880a87a47c0 by task syz-executor559/9563 > > > > CPU: 0 PID: 9563 Comm: syz-executor559 Not tainted 5.5.0-rc5-syzkaller #0 > > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS > > Google 01/01/2011 > > Call Trace: > > __dump_stack lib/dump_stack.c:77 [inline] > > dump_stack+0x197/0x210 lib/dump_stack.c:118 > > print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374 > > __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506 > > kasan_report+0x12/0x20 mm/kasan/common.c:639 > > check_memory_region_inline mm/kasan/generic.c:185 [inline] > > check_memory_region+0x134/0x1a0 mm/kasan/generic.c:192 > > __kasan_check_read+0x11/0x20 mm/kasan/common.c:95 > > test_bit include/asm-generic/bitops/instrumented-non-atomic.h:110 [inline] > > bitmap_port_ext_cleanup+0xe6/0x2a0 > > map->members is freed by ip_set_free() right before using it in > mtype_ext_cleanup() again. So I think probably we just have to > move it down: Yes, exactly. As you suggested, could you submit a patch? Acked-by: Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxx> Best regards, Jozsef > 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; > > Thanks. > - E-mail : kadlec@xxxxxxxxxxxxxxxxx, kadlecsik.jozsef@xxxxxxxxxxxxx PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt Address : Wigner Research Centre for Physics H-1525 Budapest 114, POB. 49, Hungary