projects
/
GitHub
/
moto-9609
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6609d11
)
netfilter: x_tables: avoid out-of-bounds reads in xt_request_find_{match|target}
author
Eric Dumazet
<edumazet@google.com>
Thu, 25 Jan 2018 01:16:09 +0000
(17:16 -0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Sun, 25 Feb 2018 10:07:50 +0000
(11:07 +0100)
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
patch
|
blob
|
blame
|
history
diff --git
a/net/netfilter/x_tables.c
b/net/netfilter/x_tables.c
index 20f7856fec16aa5b38cad0a0432fd8d844bd99e6..60c92158a2cd56a06752f827bb5ec1a59b3e5f32 100644
(file)
--- a/
net/netfilter/x_tables.c
+++ b/
net/netfilter/x_tables.c
@@
-209,6
+209,9
@@
xt_request_find_match(uint8_t nfproto, const char *name, uint8_t revision)
{
struct xt_match *match;
+ if (strnlen(name, XT_EXTENSION_MAXNAMELEN) == XT_EXTENSION_MAXNAMELEN)
+ return ERR_PTR(-EINVAL);
+
match = xt_find_match(nfproto, name, revision);
if (IS_ERR(match)) {
request_module("%st_%s", xt_prefix[nfproto], name);
@@
-251,6
+254,9
@@
struct xt_target *xt_request_find_target(u8 af, const char *name, u8 revision)
{
struct xt_target *target;
+ if (strnlen(name, XT_EXTENSION_MAXNAMELEN) == XT_EXTENSION_MAXNAMELEN)
+ return ERR_PTR(-EINVAL);
+
target = xt_find_target(af, name, revision);
if (IS_ERR(target)) {
request_module("%st_%s", xt_prefix[af], name);