kernel-ark/net/unix
Paul Moore ded34e0fe8 unix: fix a race condition in unix_release()
As reported by Jan, and others over the past few years, there is a
race condition caused by unix_release setting the sock->sk pointer
to NULL before properly marking the socket as dead/orphaned.  This
can cause a problem with the LSM hook security_unix_may_send() if
there is another socket attempting to write to this partially
released socket in between when sock->sk is set to NULL and it is
marked as dead/orphaned.  This patch fixes this by only setting
sock->sk to NULL after the socket has been marked as dead; I also
take the opportunity to make unix_release_sock() a void function
as it only ever returned 0/success.

Dave, I think this one should go on the -stable pile.

Special thanks to Jan for coming up with a reproducer for this
problem.

Reported-by: Jan Stancek <jan.stancek@gmail.com>
Signed-off-by: Paul Moore <pmoore@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-03-25 13:11:48 -04:00
..
af_unix.c unix: fix a race condition in unix_release() 2013-03-25 13:11:48 -04:00
diag.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
garbage.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
Kconfig net: Default UDP and UNIX diag to 'n'. 2012-01-07 12:13:06 -08:00
Makefile unix_diag: Write it into kbuild 2011-12-16 13:48:29 -05:00
sysctl_net_unix.c net: Don't export sysctls to unprivileged users 2012-11-18 20:30:55 -05:00