summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorCasey Schaufler <casey@schaufler-ca.com>2020-09-22 14:59:31 -0700
committerCasey Schaufler <casey@schaufler-ca.com>2020-09-22 14:59:31 -0700
commitbf0afe673b999439b6a53c75727821795ccb27e2 (patch)
treeb8632f16c8f8b0ba97ab28b476b4b80e11b0fea6 /security
parent322dd63c7f98315b5794653bc582d109841219ae (diff)
Smack: Fix build when NETWORK_SECMARK is not set
Use proper conditional compilation for the secmark field in the network skb. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Diffstat (limited to 'security')
-rw-r--r--security/smack/smack_lsm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 86db667ce319..aa60a9468734 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -3838,6 +3838,7 @@ static int smk_skb_to_addr_ipv6(struct sk_buff *skb, struct sockaddr_in6 *sip)
*
* Returns smack_known of the secmark or NULL if that won't work.
*/
+#ifdef CONFIG_NETWORK_SECMARK
static struct smack_known *smack_from_skb(struct sk_buff *skb)
{
if (skb == NULL || skb->secmark == 0)
@@ -3845,6 +3846,12 @@ static struct smack_known *smack_from_skb(struct sk_buff *skb)
return smack_from_secid(skb->secmark);
}
+#else
+static inline struct smack_known *smack_from_skb(struct sk_buff *skb)
+{
+ return NULL;
+}
+#endif
/**
* smack_from_netlbl - Smack data from the IP options in an skb