netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* net/unix: sk_socket can disappear when state is unlocked
@ 2015-05-21 16:25 Mark Salyzyn
  2015-05-22  9:50 ` Hannes Frederic Sowa
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Salyzyn @ 2015-05-21 16:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mark Salyzyn, David S. Miller, Al Viro, David Howells, Ying Xue,
	Christoph Hellwig, netdev

got a rare NULL pointer dereference in clear_bit

Signed-off-by: Mark Salyzyn <salyzyn@android.com>
---
 net/unix/af_unix.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 5266ea7..37a8925 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1880,6 +1880,11 @@ static long unix_stream_data_wait(struct sock *sk, long timeo,
 		unix_state_unlock(sk);
 		timeo = freezable_schedule_timeout(timeo);
 		unix_state_lock(sk);
+
+		/* sk_socket may have been killed while unlocked */
+		if (!sk->sk_socket)
+			break;
+
 		clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
 	}
 
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-05-22 19:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-21 16:25 net/unix: sk_socket can disappear when state is unlocked Mark Salyzyn
2015-05-22  9:50 ` Hannes Frederic Sowa
2015-05-22 14:51   ` Mark Salyzyn
2015-05-22 15:35     ` Hannes Frederic Sowa
2015-05-22 16:24       ` Mark Salyzyn
2015-05-22 18:16         ` Hannes Frederic Sowa
2015-05-22 19:59           ` Mark Salyzyn

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).