]> www.infradead.org Git - users/dwmw2/linux.git/commit
selinux: Implement mptcp_add_subflow hook
authorPaolo Abeni <pabeni@redhat.com>
Thu, 20 Apr 2023 17:17:14 +0000 (19:17 +0200)
committerPaul Moore <paul@paul-moore.com>
Thu, 18 May 2023 17:11:10 +0000 (13:11 -0400)
commit85c3222dddc6697dc7513623983a2ba748ba710e
tree818980ab9317efd310646f88716eb67be87f818c
parente3d9387f002612093dbeaa272f7930ce5108033f
selinux: Implement mptcp_add_subflow hook

Newly added subflows should inherit the LSM label from the associated
MPTCP socket regardless of the current context.

This patch implements the above copying sid and class from the MPTCP
socket context, deleting the existing subflow label, if any, and then
re-creating the correct one.

The new helper reuses the selinux_netlbl_sk_security_free() function,
and the latter can end-up being called multiple times with the same
argument; we additionally need to make it idempotent.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/hooks.c
security/selinux/netlabel.c