diff options
author | David S. Miller <davem@davemloft.net> | 2011-01-05 15:38:53 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-02-17 15:14:22 -0800 |
commit | bdbeaf1567cfb79e5fc5b471d4616afd1daa16c9 (patch) | |
tree | 828deec8bd03d365749ee3170f28ff1020179151 /net | |
parent | 37b4b584a0b97498b661b4a3dcc637834d1e86a2 (diff) |
af_unix: Avoid socket->sk NULL OOPS in stream connect security hooks.
[ Upstream commit 3610cda53f247e176bcbb7a7cca64bc53b12acdb ]
unix_release() can asynchornously set socket->sk to NULL, and
it does so without holding the unix_state_lock() on "other"
during stream connects.
However, the reverse mapping, sk->sk_socket, is only transitioned
to NULL under the unix_state_lock().
Therefore make the security hooks follow the reverse mapping instead
of the forward mapping.
Reported-by: Jeremy Fitzhardinge <jeremy@goop.org>
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net')
-rw-r--r-- | net/unix/af_unix.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 2268e679812..759bbcbdfbe 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1156,7 +1156,7 @@ restart: goto restart; } - err = security_unix_stream_connect(sock, other->sk_socket, newsk); + err = security_unix_stream_connect(sk, other, newsk); if (err) { unix_state_unlock(sk); goto out_unlock; |