On Tue, May 17, 2022 at 09:21:11PM +0200, Florian Westphal wrote: > syzbot reports following warn: > WARNING: CPU: 0 PID: 3600 at net/netfilter/nfnetlink.c:703 nfnetlink_unbind+0x357/0x3b0 net/netfilter/nfnetlink.c:694 > > The syzbot generated program does this: > > socket(AF_NETLINK, SOCK_RAW, NETLINK_NETFILTER) = 3 > setsockopt(3, SOL_NETLINK, NETLINK_DROP_MEMBERSHIP, [1], 4) = 0 > > ... which triggers 'WARN_ON_ONCE(nfnlnet->ctnetlink_listeners == 0)' check. > > Instead of counting, just enable reporting for every bind request > and check if we still have listeners on unbind. > > While at it, also add the needed bounds check on nfnl_group2type[] > access. Also applied