* [PATCH net] batman-adv: fix uninit-value in batadv_netlink_get_ifindex()
@ 2019-08-12 11:57 Eric Dumazet
2019-08-14 16:36 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2019-08-12 11:57 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, Eric Dumazet, Eric Dumazet, syzbot, Marek Lindner,
Simon Wunderlich, Antonio Quartulli
batadv_netlink_get_ifindex() needs to make sure user passed
a correct u32 attribute.
syzbot reported :
BUG: KMSAN: uninit-value in batadv_netlink_dump_hardif+0x70d/0x880 net/batman-adv/netlink.c:968
CPU: 1 PID: 11705 Comm: syz-executor888 Not tainted 5.1.0+ #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x191/0x1f0 lib/dump_stack.c:113
kmsan_report+0x130/0x2a0 mm/kmsan/kmsan.c:622
__msan_warning+0x75/0xe0 mm/kmsan/kmsan_instr.c:310
batadv_netlink_dump_hardif+0x70d/0x880 net/batman-adv/netlink.c:968
genl_lock_dumpit+0xc6/0x130 net/netlink/genetlink.c:482
netlink_dump+0xa84/0x1ab0 net/netlink/af_netlink.c:2253
__netlink_dump_start+0xa3a/0xb30 net/netlink/af_netlink.c:2361
genl_family_rcv_msg net/netlink/genetlink.c:550 [inline]
genl_rcv_msg+0xfc1/0x1a40 net/netlink/genetlink.c:627
netlink_rcv_skb+0x431/0x620 net/netlink/af_netlink.c:2486
genl_rcv+0x63/0x80 net/netlink/genetlink.c:638
netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline]
netlink_unicast+0xf3e/0x1020 net/netlink/af_netlink.c:1337
netlink_sendmsg+0x127e/0x12f0 net/netlink/af_netlink.c:1926
sock_sendmsg_nosec net/socket.c:651 [inline]
sock_sendmsg net/socket.c:661 [inline]
___sys_sendmsg+0xcc6/0x1200 net/socket.c:2260
__sys_sendmsg net/socket.c:2298 [inline]
__do_sys_sendmsg net/socket.c:2307 [inline]
__se_sys_sendmsg+0x305/0x460 net/socket.c:2305
__x64_sys_sendmsg+0x4a/0x70 net/socket.c:2305
do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
entry_SYSCALL_64_after_hwframe+0x63/0xe7
RIP: 0033:0x440209
Fixes: b60620cf567b ("batman-adv: netlink: hardif query")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Cc: Marek Lindner <mareklindner@neomailbox.ch>
Cc: Simon Wunderlich <sw@simonwunderlich.de>
Cc: Antonio Quartulli <a@unstable.cc>
---
net/batman-adv/netlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c
index 6f08fd122a8ddea43600c856a6be171dc7625d9c..7e052d6f759b659dbee0edd7546c367cf14b8e9e 100644
--- a/net/batman-adv/netlink.c
+++ b/net/batman-adv/netlink.c
@@ -164,7 +164,7 @@ batadv_netlink_get_ifindex(const struct nlmsghdr *nlh, int attrtype)
{
struct nlattr *attr = nlmsg_find_attr(nlh, GENL_HDRLEN, attrtype);
- return attr ? nla_get_u32(attr) : 0;
+ return (attr && nla_len(attr) == sizeof(u32)) ? nla_get_u32(attr) : 0;
}
/**
--
2.23.0.rc1.153.gdeed80330f-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] batman-adv: fix uninit-value in batadv_netlink_get_ifindex()
2019-08-12 11:57 [PATCH net] batman-adv: fix uninit-value in batadv_netlink_get_ifindex() Eric Dumazet
@ 2019-08-14 16:36 ` David Miller
2019-08-16 8:07 ` Simon Wunderlich
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2019-08-14 16:36 UTC (permalink / raw)
To: edumazet; +Cc: netdev, eric.dumazet, syzkaller, mareklindner, sw, a
From: Eric Dumazet <edumazet@google.com>
Date: Mon, 12 Aug 2019 04:57:27 -0700
> batadv_netlink_get_ifindex() needs to make sure user passed
> a correct u32 attribute.
...
> Fixes: b60620cf567b ("batman-adv: netlink: hardif query")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: syzbot <syzkaller@googlegroups.com>
Simon, I assume I will get this ultimately from you.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] batman-adv: fix uninit-value in batadv_netlink_get_ifindex()
2019-08-14 16:36 ` David Miller
@ 2019-08-16 8:07 ` Simon Wunderlich
0 siblings, 0 replies; 3+ messages in thread
From: Simon Wunderlich @ 2019-08-16 8:07 UTC (permalink / raw)
To: David Miller; +Cc: edumazet, netdev, eric.dumazet, syzkaller, mareklindner, a
[-- Attachment #1: Type: text/plain, Size: 605 bytes --]
Hi David,
yes, you will get it through me. I'll schedule a pull request next week.
Cheers,
Simon
On Wednesday, August 14, 2019 6:36:25 PM CEST David Miller wrote:
> From: Eric Dumazet <edumazet@google.com>
> Date: Mon, 12 Aug 2019 04:57:27 -0700
>
> > batadv_netlink_get_ifindex() needs to make sure user passed
> > a correct u32 attribute.
>
> ...
>
> > Fixes: b60620cf567b ("batman-adv: netlink: hardif query")
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
> > Reported-by: syzbot <syzkaller@googlegroups.com>
>
> Simon, I assume I will get this ultimately from you.
>
> Thanks.
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-16 8:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-12 11:57 [PATCH net] batman-adv: fix uninit-value in batadv_netlink_get_ifindex() Eric Dumazet
2019-08-14 16:36 ` David Miller
2019-08-16 8:07 ` Simon Wunderlich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).