diff options
author | Xu Kuohai <xukuohai@huawei.com> | 2024-07-24 05:06:58 +0300 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2024-07-31 21:46:51 +0300 |
commit | be72a57527fde6c80061c5f9d0e28762eb817b03 (patch) | |
tree | abefde6ce06f167ce75f8f3802fc227934cdb9c8 /include/linux/security.h | |
parent | 61a1dcdceb44d79e5ab511295791b88ea178c045 (diff) | |
download | linux-be72a57527fde6c80061c5f9d0e28762eb817b03.tar.xz |
lsm: Refactor return value of LSM hook vm_enough_memory
To be consistent with most LSM hooks, convert the return value of
hook vm_enough_memory to 0 or a negative error code.
Before:
- Hook vm_enough_memory returns 1 if permission is granted, 0 if not.
- LSM_RET_DEFAULT(vm_enough_memory_mm) is 1.
After:
- Hook vm_enough_memory reutrns 0 if permission is granted, negative
error code if not.
- LSM_RET_DEFAULT(vm_enough_memory_mm) is 0.
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 'include/linux/security.h')
-rw-r--r-- | include/linux/security.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/security.h b/include/linux/security.h index 1390f1efb4f0..62233fec8ead 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -634,7 +634,7 @@ static inline int security_settime64(const struct timespec64 *ts, static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages) { - return __vm_enough_memory(mm, pages, cap_vm_enough_memory(mm, pages)); + return __vm_enough_memory(mm, pages, !cap_vm_enough_memory(mm, pages)); } static inline int security_bprm_creds_for_exec(struct linux_binprm *bprm) |