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

Commit e01a7a1245ab ("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 9746f0503297 ("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: e01a7a1245ab ("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