--- v30
+++ v28
@@ -8,7 +8,7 @@
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: John Johansen <john.johansen@canonical.com>
-Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
+Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Cc: netdev@vger.kernel.org
@@ -69,7 +69,7 @@
{
return -ENOSYS;
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
-index 62d5f99760aa..bb9c900da6b0 100644
+index 099259fc826a..9bd72ec01785 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -106,15 +106,17 @@ int cipso_v4_rbm_strictvalid = 1;
@@ -152,7 +152,7 @@
/**
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
-index 596a75814fbf..60e36324568f 100644
+index 9910d3e9d287..289602835b75 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -66,7 +66,7 @@ struct netlbl_unlhsh_tbl {
@@ -283,10 +283,10 @@
spin_lock(&netlbl_unlhsh_lock);
list_entry = netlbl_af4list_remove(addr->s_addr, mask->s_addr,
-@@ -496,13 +490,8 @@ static int netlbl_unlhsh_remove_addr4(struct net *net,
- (dev != NULL ? dev->name : NULL),
+@@ -497,13 +491,8 @@ static int netlbl_unlhsh_remove_addr4(struct net *net,
addr->s_addr, mask->s_addr);
- dev_put(dev);
+ if (dev != NULL)
+ dev_put(dev);
- /* lsmblob_init() puts entry->secid into all of the secids
- * in blob. security_secid_to_secctx() will know which
- * security module to use to create the secctx. */
@@ -298,7 +298,7 @@
audit_log_format(audit_buf, " sec_obj=%s",
context.context);
security_release_secctx(&context);
-@@ -543,7 +532,6 @@ static int netlbl_unlhsh_remove_addr6(struct net *net,
+@@ -544,7 +533,6 @@ static int netlbl_unlhsh_remove_addr6(struct net *net,
struct audit_buffer *audit_buf;
struct net_device *dev;
struct lsmcontext context;
@@ -306,10 +306,10 @@
spin_lock(&netlbl_unlhsh_lock);
list_entry = netlbl_af6list_remove(addr, mask, &iface->addr6_list);
-@@ -561,13 +549,8 @@ static int netlbl_unlhsh_remove_addr6(struct net *net,
- (dev != NULL ? dev->name : NULL),
+@@ -563,13 +551,8 @@ static int netlbl_unlhsh_remove_addr6(struct net *net,
addr, mask);
- dev_put(dev);
+ if (dev != NULL)
+ dev_put(dev);
- /* lsmblob_init() puts entry->secid into all of the secids
- * in blob. security_secid_to_secctx() will know which
- * security module to use to create the secctx. */
@@ -321,7 +321,7 @@
audit_log_format(audit_buf, " sec_obj=%s",
context.context);
security_release_secctx(&context);
-@@ -921,14 +904,8 @@ static int netlbl_unlabel_staticadd(struct sk_buff *skb,
+@@ -923,14 +906,8 @@ static int netlbl_unlabel_staticadd(struct sk_buff *skb,
if (ret_val != 0)
return ret_val;
@@ -338,7 +338,7 @@
}
/**
-@@ -975,11 +952,8 @@ static int netlbl_unlabel_staticadddef(struct sk_buff *skb,
+@@ -977,11 +954,8 @@ static int netlbl_unlabel_staticadddef(struct sk_buff *skb,
if (ret_val != 0)
return ret_val;
@@ -352,7 +352,7 @@
}
/**
-@@ -1091,8 +1065,7 @@ static int netlbl_unlabel_staticlist_gen(u32 cmd,
+@@ -1093,8 +1067,7 @@ static int netlbl_unlabel_staticlist_gen(u32 cmd,
struct net_device *dev;
struct lsmcontext context;
void *data;
@@ -362,7 +362,7 @@
data = genlmsg_put(cb_arg->skb, NETLINK_CB(cb_arg->nl_cb->skb).portid,
cb_arg->seq, &netlbl_unlabel_gnl_family,
-@@ -1130,7 +1103,7 @@ static int netlbl_unlabel_staticlist_gen(u32 cmd,
+@@ -1132,7 +1105,7 @@ static int netlbl_unlabel_staticlist_gen(u32 cmd,
if (ret_val != 0)
goto list_cb_failure;
@@ -371,7 +371,7 @@
} else {
ret_val = nla_put_in6_addr(cb_arg->skb,
NLBL_UNLABEL_A_IPV6ADDR,
-@@ -1144,14 +1117,10 @@ static int netlbl_unlabel_staticlist_gen(u32 cmd,
+@@ -1146,14 +1119,10 @@ static int netlbl_unlabel_staticlist_gen(u32 cmd,
if (ret_val != 0)
goto list_cb_failure;
@@ -388,7 +388,7 @@
if (ret_val != 0)
goto list_cb_failure;
ret_val = nla_put(cb_arg->skb,
-@@ -1510,7 +1479,7 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb,
+@@ -1512,7 +1481,7 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb,
&iface->addr4_list);
if (addr4 == NULL)
goto unlabel_getattr_nolabel;
@@ -397,7 +397,7 @@
break;
}
#if IS_ENABLED(CONFIG_IPV6)
-@@ -1523,7 +1492,7 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb,
+@@ -1525,7 +1494,7 @@ int netlbl_unlabel_getattr(const struct sk_buff *skb,
&iface->addr6_list);
if (addr6 == NULL)
goto unlabel_getattr_nolabel;
@@ -420,12 +420,12 @@
int netlbl_unlhsh_remove(struct net *net,
const char *dev_name,
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
-index 824a6e4fb126..6f790d96594d 100644
+index 3b95eb39a3bf..12ae311b7275 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
-@@ -7056,7 +7056,7 @@ static int selinux_uring_sqpoll(void)
+@@ -7112,7 +7112,7 @@ static int selinux_perf_event_write(struct perf_event *event)
}
- #endif /* CONFIG_IO_URING */
+ #endif
-static struct lsm_id selinux_lsmid __lsm_ro_after_init = {
+struct lsm_id selinux_lsmid __lsm_ro_after_init = {
@@ -445,10 +445,10 @@
/*
* type_datum properties
diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c
-index 800ab4b4239e..0b8f99703462 100644
+index 6a94b31b5472..d8d7603ab14e 100644
--- a/security/selinux/netlabel.c
+++ b/security/selinux/netlabel.c
-@@ -109,7 +109,7 @@ static struct netlbl_lsm_secattr *selinux_netlbl_sock_getattr(
+@@ -108,7 +108,7 @@ static struct netlbl_lsm_secattr *selinux_netlbl_sock_getattr(
return NULL;
if ((secattr->flags & NETLBL_SECATTR_SECID) &&
@@ -458,7 +458,7 @@
return NULL;
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
-index 8e92af7dd284..23a45c9dcf04 100644
+index d84c77f370dc..f6be8cd7666b 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -3899,7 +3899,7 @@ int security_netlbl_secattr_to_sid(struct selinux_state *state,
@@ -480,22 +480,22 @@
mls_export_netlbl_lvl(policydb, ctx, secattr);
rc = mls_export_netlbl_cat(policydb, ctx, secattr);
diff --git a/security/smack/smack.h b/security/smack/smack.h
-index 66b813e15196..44fd5bc8ba71 100644
+index b5bdf947792f..0eaae6b3f935 100644
--- a/security/smack/smack.h
+++ b/security/smack/smack.h
@@ -303,6 +303,7 @@ int smack_populate_secattr(struct smack_known *skp);
* Shared data.
*/
- extern int smack_enabled __initdata;
+ extern int smack_enabled;
+extern struct lsm_id smack_lsmid;
extern int smack_cipso_direct;
extern int smack_cipso_mapped;
extern struct smack_known *smack_net_ambient;
diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c
-index d2186e2757be..c6dcafe18912 100644
+index 1f391f6a3d47..ceea74bbaedc 100644
--- a/security/smack/smack_access.c
+++ b/security/smack/smack_access.c
-@@ -524,7 +524,7 @@ int smack_populate_secattr(struct smack_known *skp)
+@@ -525,7 +525,7 @@ int smack_populate_secattr(struct smack_known *skp)
{
int slen;
@@ -505,10 +505,10 @@
skp->smk_netlabel.cache = netlbl_secattr_cache_alloc(GFP_ATOMIC);
if (skp->smk_netlabel.cache != NULL) {
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
-index 1069ba7abf40..9832b5e5c9fd 100644
+index 7aa7ea38f627..e65497a5c095 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
-@@ -3729,11 +3729,12 @@ static struct smack_known *smack_from_secattr(struct netlbl_lsm_secattr *sap,
+@@ -3720,11 +3720,12 @@ static struct smack_known *smack_from_secattr(struct netlbl_lsm_secattr *sap,
if ((sap->flags & NETLBL_SECATTR_CACHE) != 0)
return (struct smack_known *)sap->cache->data;
@@ -525,7 +525,7 @@
if ((sap->flags & NETLBL_SECATTR_MLS_LVL) != 0) {
/*
-@@ -4752,7 +4753,7 @@ struct lsm_blob_sizes smack_blob_sizes __lsm_ro_after_init = {
+@@ -4701,7 +4702,7 @@ struct lsm_blob_sizes smack_blob_sizes __lsm_ro_after_init = {
.lbs_superblock = sizeof(struct superblock_smack),
};
@@ -535,10 +535,10 @@
.slot = LSMBLOB_NEEDED
};
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
-index 658eab05599e..13c2fa728054 100644
+index 3a75d2a8f517..9cda52f2ec31 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
-@@ -1143,6 +1143,7 @@ static void smk_net4addr_insert(struct smk_net4addr *new)
+@@ -1142,6 +1142,7 @@ static void smk_net4addr_insert(struct smk_net4addr *new)
static ssize_t smk_write_net4addr(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
@@ -546,7 +546,7 @@
struct smk_net4addr *snp;
struct sockaddr_in newname;
char *smack;
-@@ -1274,10 +1275,13 @@ static ssize_t smk_write_net4addr(struct file *file, const char __user *buf,
+@@ -1273,10 +1274,13 @@ static ssize_t smk_write_net4addr(struct file *file, const char __user *buf,
* this host so that incoming packets get labeled.
* but only if we didn't get the special CIPSO option
*/