diff options
author | Casey Schaufler <casey@schaufler-ca.com> | 2024-10-24 00:21:56 +0300 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2024-12-04 22:58:09 +0300 |
commit | 76ecf306ae5da84ef8f48c7a2608736e6866440c (patch) | |
tree | 1a16d52f50d469cfa8ebdac9e84e597afb48b065 /security/selinux/hooks.c | |
parent | 2d470c778120d3cdb8d8ab250329ca85f49f12b1 (diff) | |
download | linux-76ecf306ae5da84ef8f48c7a2608736e6866440c.tar.xz |
lsm: use lsm_context in security_inode_getsecctx
Change the security_inode_getsecctx() interface to fill a lsm_context
structure instead of data and length pointers. This provides
the information about which LSM created the context so that
security_release_secctx() can use the correct hook.
Cc: linux-nfs@vger.kernel.org
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
[PM: subject tweak]
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index ddc24db7c0b2..9254570de103 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -6711,14 +6711,16 @@ static int selinux_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen) ctx, ctxlen, 0, NULL); } -static int selinux_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen) +static int selinux_inode_getsecctx(struct inode *inode, struct lsm_context *cp) { - int len = 0; + int len; len = selinux_inode_getsecurity(&nop_mnt_idmap, inode, - XATTR_SELINUX_SUFFIX, ctx, true); + XATTR_SELINUX_SUFFIX, + (void **)&cp->context, true); if (len < 0) return len; - *ctxlen = len; + cp->len = len; + cp->id = LSM_ID_SELINUX; return 0; } #ifdef CONFIG_KEYS |