]> git.baikalelectronics.ru Git - kernel.git/commit
selinux: fix address family in bind() and connect() to match address/port
authorAlexey Kodanev <alexey.kodanev@oracle.com>
Fri, 11 May 2018 17:15:12 +0000 (20:15 +0300)
committerPaul Moore <paul@paul-moore.com>
Mon, 14 May 2018 19:19:25 +0000 (15:19 -0400)
commitebdb2845ebfc96f100818de848c5012818d2570e
treeb39eaeabeabb993ffcfffe9fb6f566a32ad4975a
parentc4cf6bf881d301f03c38efe3ba4001103cf9ae76
selinux: fix address family in bind() and connect() to match address/port

Since sctp_bindx() and sctp_connectx() can have multiple addresses,
sk_family can differ from sa_family. Therefore, selinux_socket_bind()
and selinux_socket_connect_helper(), which process sockaddr structure
(address and port), should use the address family from that structure
too, and not from the socket one.

The initialization of the data for the audit record is moved above,
in selinux_socket_bind(), so that there is no duplicate changes and
code.

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