]> 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)
commit207320b918a5907cb7578f361effd78793645f57
treeb39eaeabeabb993ffcfffe9fb6f566a32ad4975a
parentfa1a313fa3be229c401f72c6c786e7f5fb4d8a66
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: a18ad9955c47 ("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