diff mbox

[22/25] LSM: Put new key blob code under ifdef

Message ID a1555a12-3e0f-84ad-fdf2-95a029c1a0dc@schaufler-ca.com (mailing list archive)
State New, archived
Headers show

Commit Message

Casey Schaufler Aug. 13, 2016, 8:38 p.m. UTC
Subject: [PATCH 22/25] LSM: Put new key blob code under ifdef

A repair for the preceeding patch, where the new key related
code was not properly ifdefed.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
---
 security/security.c               | 6 +++++-
 security/selinux/hooks.c          | 2 ++
 security/selinux/include/objsec.h | 2 ++
 security/smack/smack.h            | 2 ++
 security/smack/smack_lsm.c        | 2 ++
 5 files changed, 13 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/security/security.c b/security/security.c
index 5dd1d57..9eade94 100644
--- a/security/security.c
+++ b/security/security.c
@@ -90,11 +90,13 @@  int __init security_init(void)
 	pr_info("LSM: file blob size       = %d\n", blob_sizes.lbs_file);
 	pr_info("LSM: inode blob size      = %d\n", blob_sizes.lbs_inode);
 	pr_info("LSM: ipc blob size        = %d\n", blob_sizes.lbs_ipc);
+#ifdef CONFIG_KEYS
 	pr_info("LSM: key blob size        = %d\n", blob_sizes.lbs_key);
+#endif /* CONFIG_KEYS */
 	pr_info("LSM: msg_msg blob size    = %d\n", blob_sizes.lbs_msg_msg);
 	pr_info("LSM: sock blob size       = %d\n", blob_sizes.lbs_sock);
 	pr_info("LSM: superblock blob size = %d\n", blob_sizes.lbs_superblock);
-#endif
+#endif /* CONFIG_SECURITY_STACKING_DEBUG */
 
 	return 0;
 }
@@ -316,6 +318,7 @@  int lsm_ipc_alloc(struct kern_ipc_perm *kip)
 	return 0;
 }
 
+#ifdef CONFIG_KEYS
 /**
  * lsm_key_alloc - allocate a composite key blob
  * @key: the key that needs a blob
@@ -340,6 +343,7 @@  int lsm_key_alloc(struct key *key)
 		return -ENOMEM;
 	return 0;
 }
+#endif /* CONFIG_KEYS */
 
 /**
  * lsm_msg_msg_alloc - allocate a composite msg_msg blob
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index d20c46a..668fde5 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -5867,7 +5867,9 @@  struct lsm_blob_sizes selinux_blob_sizes = {
 	.lbs_file = sizeof(struct file_security_struct),
 	.lbs_inode = sizeof(struct inode_security_struct),
 	.lbs_ipc = sizeof(struct ipc_security_struct),
+#ifdef CONFIG_KEYS
 	.lbs_key = sizeof(struct key_security_struct),
+#endif /* CONFIG_KEYS */
 	.lbs_msg_msg = sizeof(struct msg_security_struct),
 	.lbs_sock = sizeof(struct sk_security_struct),
 	.lbs_superblock = sizeof(struct superblock_security_struct),
diff --git a/security/selinux/include/objsec.h b/security/selinux/include/objsec.h
index cd12239..cf48aea 100644
--- a/security/selinux/include/objsec.h
+++ b/security/selinux/include/objsec.h
@@ -188,6 +188,7 @@  static inline struct ipc_security_struct *selinux_ipc(
 #endif
 }
 
+#ifdef CONFIG_KEYS
 static inline struct key_security_struct *selinux_key(const struct key *key)
 {
 #ifdef CONFIG_SECURITY_STACKING
@@ -196,6 +197,7 @@  static inline struct key_security_struct *selinux_key(const struct key *key)
 	return key->security;
 #endif
 }
+#endif /* CONFIG_KEYS */
 
 static inline struct sk_security_struct *selinux_sock(const struct sock *sock)
 {
diff --git a/security/smack/smack.h b/security/smack/smack.h
index f7c2945..6e147d8 100644
--- a/security/smack/smack.h
+++ b/security/smack/smack.h
@@ -405,6 +405,7 @@  static inline struct smack_known **smack_ipc(const struct kern_ipc_perm *ipc)
 #endif
 }
 
+#ifdef CONFIG_KEYS
 static inline struct smack_known **smack_key(const struct key *key)
 {
 #ifdef CONFIG_SECURITY_STACKING
@@ -413,6 +414,7 @@  static inline struct smack_known **smack_key(const struct key *key)
 	return key->security;
 #endif
 }
+#endif /* CONFIG_KEYS */
 
 /*
  * Is the directory transmuting?
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 9ac6487..b3986e9 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -4444,7 +4444,9 @@  struct lsm_blob_sizes smack_blob_sizes = {
 	.lbs_file = sizeof(struct smack_known *),
 	.lbs_inode = sizeof(struct inode_smack),
 	.lbs_ipc = sizeof(struct smack_known *),
+#ifdef CONFIG_KEYS
 	.lbs_key = sizeof(struct smack_known *),
+#endif /* CONFIG_KEYS */
 	.lbs_msg_msg = sizeof(struct smack_known *),
 	.lbs_sock = sizeof(struct socket_smack),
 	.lbs_superblock = sizeof(struct superblock_smack),