diff options
author | Eric Dumazet <edumazet@google.com> | 2012-09-24 07:00:11 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-13 05:28:07 +0900 |
commit | 1a6b2c9da08fe3dc1fa825dfefcc70010c088a35 (patch) | |
tree | fea4bb6d8c7160eb646c3c93704b3674f1fbe7a5 /net | |
parent | 74665a9b4fca3420c07f1e583242a477b2eb34b0 (diff) | |
download | kernel_samsung_crespo-1a6b2c9da08fe3dc1fa825dfefcc70010c088a35.zip kernel_samsung_crespo-1a6b2c9da08fe3dc1fa825dfefcc70010c088a35.tar.gz kernel_samsung_crespo-1a6b2c9da08fe3dc1fa825dfefcc70010c088a35.tar.bz2 |
net: guard tcp_set_keepalive() to tcp sockets
[ Upstream commit 3e10986d1d698140747fcfc2761ec9cb64c1d582 ]
Its possible to use RAW sockets to get a crash in
tcp_set_keepalive() / sk_reset_timer()
Fix is to make sure socket is a SOCK_STREAM one.
Reported-by: Dave Jones <davej@redhat.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/sock.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 56623ad..3da11ba 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -594,7 +594,8 @@ set_rcvbuf: case SO_KEEPALIVE: #ifdef CONFIG_INET - if (sk->sk_protocol == IPPROTO_TCP) + if (sk->sk_protocol == IPPROTO_TCP && + sk->sk_type == SOCK_STREAM) tcp_set_keepalive(sk, valbool); #endif sock_valbool_flag(sk, SOCK_KEEPOPEN, valbool); |