OSDN Git Service

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)
commit0f8db8cc73df60b3de9a5eebd8f117b56eff5b03
treec890791d42e34d4dcb9bad3307143246a13adb81
parent6b6bc6205d98796361962ee282a063f18ba8dc57
selinux: add AF_UNSPEC and INADDR_ANY checks to selinux_socket_bind()

Commit d452930fd3b9 ("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 29c486df6a20 ("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: d452930fd3b9 ("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