netfilter: x_tables: avoid out-of-bounds reads in xt_request_find_{match|target}
authorEric Dumazet <edumazet@google.com>
Thu, 25 Jan 2018 01:16:09 +0000 (17:16 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Feb 2018 10:05:43 +0000 (11:05 +0100)
commitb39f3f381bf3ba387d62655539a8979085cb6ff6
treede477610b4263abc7ca5b8f02f0ebe71de7ee930
parent1099c708d7b7bcb701ac9f892d8f26811842abdd
netfilter: x_tables: avoid out-of-bounds reads in xt_request_find_{match|target}

commit da17c73b6eb74aad3c3c0654394635675b623b3e upstream.

It looks like syzbot found its way into netfilter territory.

Issue here is that @name comes from user space and might
not be null terminated.

Out-of-bound reads happen, KASAN is not happy.

v2 added similar fix for xt_request_find_target(),
as Florian advised.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/x_tables.c