[PATCH 11/59] LSM: Fix logical operation in lsm_export checks
Casey Schaufler
casey at schaufler-ca.com
Tue Apr 9 19:58:36 UTC 2019
Fix the logic in Smack and SELinux when checking to
see if the secid is included.
Signed-off-by: Casey Schaufler <casey at schaufler-ca.com>
---
security/selinux/include/objsec.h | 2 +-
security/smack/smack_lsm.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/security/selinux/include/objsec.h b/security/selinux/include/objsec.h
index d7efc5f23c1e..59a3b1cd5ba9 100644
--- a/security/selinux/include/objsec.h
+++ b/security/selinux/include/objsec.h
@@ -61,7 +61,7 @@ static inline void selinux_export_secid(struct lsm_export *l, u32 secid)
static inline void selinux_import_secid(struct lsm_export *l, u32 *secid)
{
- if (l->flags | LSM_EXPORT_SELINUX)
+ if (l->flags & LSM_EXPORT_SELINUX)
*secid = l->selinux;
else
*secid = SECSID_NULL;
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 0e048c1456ed..a3776501965d 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -477,7 +477,7 @@ static inline void smack_export_secid(struct lsm_export *l, u32 secid)
static inline void smack_import_secid(struct lsm_export *l, u32 *secid)
{
- if (l->flags | LSM_EXPORT_SMACK)
+ if (l->flags & LSM_EXPORT_SMACK)
*secid = l->smack;
else
*secid = 0;
--
2.19.1
More information about the Linux-security-module-archive
mailing list