Patch "unix/caif: sk_socket can disappear when state is unlocked" has been added to the 4.0-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
unix/caif: sk_socket can disappear when state is unlocked
to the 4.0-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
unix-caif-sk_socket-can-disappear-when-state-is-unlocked.patch
and it can be found in the queue-4.0 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Sat Jun 13 09:48:35 PDT 2015
From: Mark Salyzyn <[email protected]>
Date: Tue, 26 May 2015 08:22:19 -0700
Subject: unix/caif: sk_socket can disappear when state is unlocked
From: Mark Salyzyn <[email protected]>
[ Upstream commit b48732e4a48d80ed4a14812f0bab09560846514e ]
got a rare NULL pointer dereference in clear_bit
----
v2: switch to sock_flag(sk, SOCK_DEAD) and added net/caif/caif_socket.c
v3: return -ECONNRESET in upstream caller of wait function for SOCK_DEAD
--- net/caif/caif_socket.c | 8 ++++++++ net/unix/af_unix.c | 8 ++++++++ 2 files changed, 16 insertions(+)
net/caif/caif_socket.c +8 -0
@@ -330,6 +330,10 @@ static long caif_stream_data_wait(structrelease_sock (sk); timeo =schedule_timeout (timeo);lock_sock (sk); + +if (sock_flag (sk,SOCK_DEAD )) +break ; +clear_bit (SOCK_ASYNC_WAITDATA , &sk->sk_socket->flags); }
@@ -374,6 +378,10 @@ static int caif_stream_recvmsg(struct kistruct sk_buff *skb;lock_sock (sk); +if (sock_flag (sk,SOCK_DEAD )) { + err = -ECONNRESET ; + goto unlock; + } skb =skb_dequeue (&sk->sk_receive_queue);caif_check_flow_release (sk);
net/unix/af_unix.c +8 -0
@@ -1887,6 +1887,10 @@ static long unix_stream_data_wait(structunix_state_unlock (sk); timeo =freezable_schedule_timeout (timeo);unix_state_lock (sk); + +if (sock_flag (sk,SOCK_DEAD )) +break ; +clear_bit (SOCK_ASYNC_WAITDATA , &sk->sk_socket->flags); }
@@ -1947,6 +1951,10 @@ static int unix_stream_recvmsg(struct kistruct sk_buff *skb, *last;unix_state_lock (sk); +if (sock_flag (sk,SOCK_DEAD )) { + err = -ECONNRESET ; + goto unlock; + } last = skb =skb_peek (&sk->sk_receive_queue); again:if (skb ==NULL ) {
Patches currently in stable-queue which might be from [email protected] are
queue-4.0/unix-caif-sk_socket-can-disappear-when-state-is-unlocked.patch