[PATCH 6.18.y 2/7] Revert "selinux: reject a class permission count below its inherited common"

Wentao Guan <[email protected]>
Newsgroups org.kernel.vger.stable
Message-ID <[email protected]>
This reverts commit 9f721b5d9e1d956ffe965bc09375989eb51881fd.

This pick was applied without its upstream prerequisites (commit
fa79a596848f "selinux: use u16 for security classes" and commit
18fa21f10d00 "selinux: more strict policy parsing") and is therefore
incomplete. Drop it here; it is re-applied later in this series in the
correct upstream order.

Signed-off-by: Wentao Guan <[email protected]>
---
 security/selinux/ss/policydb.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 69c19ef4b8817..48ee87070ab0d 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -1385,18 +1385,6 @@ static int class_read(struct policydb *p, struct symtab *s, struct policy_file *
 			       cladatum->comkey);
 			goto bad;
 		}
-
-		/*
-		 * security_get_permissions() maps the common's permissions
-		 * into an array sized by this class's nprim, so a class must
-		 * declare at least as many as the common it inherits.
-		 */
-		if (cladatum->permissions.nprim <
-		    cladatum->comdatum->permissions.nprim) {
-			pr_err("SELinux:  class %s has fewer permissions than common %s\n",
-			       key, cladatum->comkey);
-			goto bad;
-		}
 	}
 	for (i = 0; i < nel; i++) {
 		rc = perm_read(p, &cladatum->permissions, fp);
-- 
2.30.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.