]> git.baikalelectronics.ru Git - kernel.git/commit
selinux: add AF_UNSPEC and INADDR_ANY checks to selinux_socket_bind()
authorAlexey Kodanev <alexey.kodanev@oracle.com>
Fri, 11 May 2018 17:15:11 +0000 (20:15 +0300)
committerPaul Moore <paul@paul-moore.com>
Mon, 14 May 2018 19:17:02 +0000 (15:17 -0400)
commitfa1a313fa3be229c401f72c6c786e7f5fb4d8a66
treec890791d42e34d4dcb9bad3307143246a13adb81
parent9a6a748cfcbad225563f7ba6a5bc28419941d6fb
selinux: add AF_UNSPEC and INADDR_ANY checks to selinux_socket_bind()

Commit a18ad9955c47 ("selinux: Add SCTP support") breaks compatibility
with the old programs that can pass sockaddr_in structure with AF_UNSPEC
and INADDR_ANY to bind(). As a result, bind() returns EAFNOSUPPORT error.
This was found with LTP/asapi_01 test.

Similar to commit ab3a9e21c45a ("net: ipv4: relax AF_INET check in
bind()"), which relaxed AF_INET check for compatibility, add AF_UNSPEC
case to AF_INET and make sure that the address is INADDR_ANY.

Fixes: a18ad9955c47 ("selinux: Add SCTP support")
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/hooks.c