diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2015-12-16 23:39:04 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-12-17 15:46:32 -0500 |
commit | ac5cc977991d2dce85fc734a6c71ddb33f6fe3c1 (patch) | |
tree | f29096c3c5c031b40928c1c3a5cf1537178b9574 /lib | |
parent | 67894eec3e27a5b61281cb68f63b933e8c111348 (diff) | |
download | linux-ac5cc977991d2dce85fc734a6c71ddb33f6fe3c1.tar.bz2 |
net: check both type and procotol for tcp sockets
Dmitry reported the following out-of-bound access:
Call Trace:
[<ffffffff816cec2e>] __asan_report_load4_noabort+0x3e/0x40
mm/kasan/report.c:294
[<ffffffff84affb14>] sock_setsockopt+0x1284/0x13d0 net/core/sock.c:880
[< inline >] SYSC_setsockopt net/socket.c:1746
[<ffffffff84aed7ee>] SyS_setsockopt+0x1fe/0x240 net/socket.c:1729
[<ffffffff85c18c76>] entry_SYSCALL_64_fastpath+0x16/0x7a
arch/x86/entry/entry_64.S:185
This is because we mistake a raw socket as a tcp socket.
We should check both sk->sk_type and sk->sk_protocol to ensure
it is a tcp socket.
Willem points out __skb_complete_tx_timestamp() needs to fix as well.
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions