selinux: do not report error on connect(AF_UNSPEC)
authorPaolo Abeni <pabeni@redhat.com>
Fri, 10 May 2019 17:12:33 +0000 (19:12 +0200)
committerPaul Moore <paul@paul-moore.com>
Tue, 21 May 2019 01:46:02 +0000 (21:46 -0400)
commit05174c95b83f8aca0c47b87115abb7a6387aafa5
treeaaade5942a3d2f9f4406355207da7db63ae1913e
parent35a196bef449b5824033865b963ed9a43fb8c730
selinux: do not report error on connect(AF_UNSPEC)

calling connect(AF_UNSPEC) on an already connected TCP socket is an
established way to disconnect() such socket. After commit 68741a8adab9
("selinux: Fix ltp test connect-syscall failure") it no longer works
and, in the above scenario connect() fails with EAFNOSUPPORT.

Fix the above explicitly early checking for AF_UNSPEC family, and
returning success in that case.

Reported-by: Tom Deseyn <tdeseyn@redhat.com>
Cc: stable@vger.kernel.org
Fixes: 68741a8adab9 ("selinux: Fix ltp test connect-syscall failure")
Suggested-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/hooks.c