summaryrefslogtreecommitdiff
path: root/security/selinux
diff options
context:
space:
mode:
authorGuillaume Nault <gnault@redhat.com>2023-07-11 16:06:08 +0300
committerDavid S. Miller <davem@davemloft.net>2023-07-14 10:27:33 +0300
commit5b52ad34f9487b2c2d1e60fe37e5bd5656b4dac8 (patch)
tree8ab0e8d94ab54af6904da1725cb26775ada6f727 /security/selinux
parentdef3833fc6022c7f23bd4fd66ba5ed65c6b23272 (diff)
downloadlinux-5b52ad34f9487b2c2d1e60fe37e5bd5656b4dac8.tar.xz
security: Constify sk in the sk_getsecid hook.
The sk_getsecid hook shouldn't need to modify its socket argument. Make it const so that callers of security_sk_classify_flow() can use a const struct sock *. Signed-off-by: Guillaume Nault <gnault@redhat.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'security/selinux')
-rw-r--r--security/selinux/hooks.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index d06e350fedee..2bdc48dd8670 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -5167,12 +5167,12 @@ static void selinux_sk_clone_security(const struct sock *sk, struct sock *newsk)
selinux_netlbl_sk_security_reset(newsksec);
}
-static void selinux_sk_getsecid(struct sock *sk, u32 *secid)
+static void selinux_sk_getsecid(const struct sock *sk, u32 *secid)
{
if (!sk)
*secid = SECINITSID_ANY_SOCKET;
else {
- struct sk_security_struct *sksec = sk->sk_security;
+ const struct sk_security_struct *sksec = sk->sk_security;
*secid = sksec->sid;
}