linux/net/netfilter/ipset
Florian Westphal 22dad713b8 netfilter: ipset: avoid null deref when IPSET_ATTR_LINENO is present
The set uadt functions assume lineno is never NULL, but it is in
case of ip_set_utest().

syzkaller managed to generate a netlink message that calls this with
LINENO attr present:

general protection fault: 0000 [#1] PREEMPT SMP KASAN
RIP: 0010:hash_mac4_uadt+0x1bc/0x470 net/netfilter/ipset/ip_set_hash_mac.c:104
Call Trace:
 ip_set_utest+0x55b/0x890 net/netfilter/ipset/ip_set_core.c:1867
 nfnetlink_rcv_msg+0xcf2/0xfb0 net/netfilter/nfnetlink.c:229
 netlink_rcv_skb+0x177/0x450 net/netlink/af_netlink.c:2477
 nfnetlink_rcv+0x1ba/0x460 net/netfilter/nfnetlink.c:563

pass a dummy lineno storage, its easier than patching all set
implementations.

This seems to be a day-0 bug.

Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Reported-by: syzbot+34bd2369d38707f3f4a7@syzkaller.appspotmail.com
Fixes: a7b4f989a6 ("netfilter: ipset: IP set core support")
Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2020-01-08 23:31:46 +01:00
..
ip_set_bitmap_gen.h netfilter: ipset: remove inline from static functions in .c files. 2019-10-07 23:57:45 +02:00
ip_set_bitmap_ip.c netfilter: ipset: move function to ip_set_bitmap_ip.c. 2019-10-07 23:58:35 +02:00
ip_set_bitmap_ipmac.c netfilter: ipset: remove inline from static functions in .c files. 2019-10-07 23:57:45 +02:00
ip_set_bitmap_port.c netfilter: ipset: move ip_set_get_ip_port() to ip_set_bitmap_port.c. 2019-10-07 23:59:02 +02:00
ip_set_core.c netfilter: ipset: avoid null deref when IPSET_ATTR_LINENO is present 2020-01-08 23:31:46 +01:00
ip_set_getport.c netfilter: ipset: move ip_set_get_ip_port() to ip_set_bitmap_port.c. 2019-10-07 23:59:02 +02:00
ip_set_hash_gen.h netfilter: ipset: remove inline from static functions in .c files. 2019-10-07 23:57:45 +02:00
ip_set_hash_ip.c netfilter: ipset: remove inline from static functions in .c files. 2019-10-07 23:57:45 +02:00
ip_set_hash_ipmac.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-11-09 11:04:37 -08:00
ip_set_hash_ipmark.c netfilter: ipset: remove inline from static functions in .c files. 2019-10-07 23:57:45 +02:00
ip_set_hash_ipport.c netfilter: ipset: remove inline from static functions in .c files. 2019-10-07 23:57:45 +02:00
ip_set_hash_ipportip.c netfilter: ipset: remove inline from static functions in .c files. 2019-10-07 23:57:45 +02:00
ip_set_hash_ipportnet.c netfilter: ipset: remove inline from static functions in .c files. 2019-10-07 23:57:45 +02:00
ip_set_hash_mac.c netfilter: ipset: remove inline from static functions in .c files. 2019-10-07 23:57:45 +02:00
ip_set_hash_net.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-11-09 11:04:37 -08:00
ip_set_hash_netiface.c netfilter: ipset: Add wildcard support to net,iface 2019-11-04 20:44:17 +01:00
ip_set_hash_netnet.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-11-09 11:04:37 -08:00
ip_set_hash_netport.c netfilter: ipset: remove inline from static functions in .c files. 2019-10-07 23:57:45 +02:00
ip_set_hash_netportnet.c netfilter: ipset: remove inline from static functions in .c files. 2019-10-07 23:57:45 +02:00
ip_set_list_set.c netfilter: ipset: remove inline from static functions in .c files. 2019-10-07 23:57:45 +02:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pfxlen.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00