]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: ipset: avoid null deref when IPSET_ATTR_LINENO is present
authorFlorian Westphal <fw@strlen.de>
Wed, 8 Jan 2020 09:59:38 +0000 (10:59 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 8 Jan 2020 22:31:46 +0000 (23:31 +0100)
commit82d1a89e715bc040b9344b4c07847d1d6c22c6a6
tree67112225e0ae6cef37c3bd450ef19eed88f140f2
parent0f6732e65cebb4b9e6208dc25099f620a1517f38
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: 53cb7e4d584ab ("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>
net/netfilter/ipset/ip_set_core.c