diff options
author | Xu Kuohai <xukuohai@huawei.com> | 2024-07-24 10:06:59 +0800 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2024-07-31 14:47:09 -0400 |
commit | 924e19c39e8f0bbd581ab8a049f95a0ed02235b1 (patch) | |
tree | 19035cdf88e11452b06828295b4cd4b372d46fd6 /security/smack | |
parent | be72a57527fde6c80061c5f9d0e28762eb817b03 (diff) |
lsm: Refactor return value of LSM hook inode_copy_up_xattr
To be consistent with most LSM hooks, convert the return value of
hook inode_copy_up_xattr to 0 or a negative error code.
Before:
- Hook inode_copy_up_xattr returns 0 when accepting xattr, 1 when
discarding xattr, -EOPNOTSUPP if it does not know xattr, or any
other negative error code otherwise.
After:
- Hook inode_copy_up_xattr returns 0 when accepting xattr, *-ECANCELED*
when discarding xattr, -EOPNOTSUPP if it does not know xattr, or
any other negative error code otherwise.
Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
Reviewed-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/smack')
-rw-r--r-- | security/smack/smack_lsm.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index d690bfda893a..da0c2bffbd08 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -4910,10 +4910,10 @@ static int smack_inode_copy_up(struct dentry *dentry, struct cred **new) static int smack_inode_copy_up_xattr(struct dentry *src, const char *name) { /* - * Return 1 if this is the smack access Smack attribute. + * Return -ECANCELED if this is the smack access Smack attribute. */ - if (strcmp(name, XATTR_NAME_SMACK) == 0) - return 1; + if (!strcmp(name, XATTR_NAME_SMACK)) + return -ECANCELED; return -EOPNOTSUPP; } |