Hi!, [Casey, sending patches in public to get an early review]
Omit non-cipso labels in cipso_seq_start(). Signed-off-by: Ahmed S. Darwish <[EMAIL PROTECTED]> --- stopping seq_show() if smk_cipso = NULL only fixes the bug symptom. We'll issue a BUG() in that case cause it signals a serious misbehavior in the list entries. diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 55ba2dc..b061cd0 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -297,14 +297,22 @@ void smk_cipso_doi(void) /* * Seq_file read operations for /smack/cipso + * + * Omit labels with no associated cipso values from being + * displayed in seq_show() */ static void *cipso_seq_start(struct seq_file *s, loff_t *pos) { + struct smack_known *skp = smack_known; + if (*pos >= smack_cipso_count) return NULL; - return smack_known; + while (skp && !skp->smk_cipso) + skp = skp->smk_next; + + return skp; } static void *cipso_seq_next(struct seq_file *s, void *v, loff_t *pos) @@ -313,9 +321,6 @@ static void *cipso_seq_next(struct seq_file *s, void *v, loff_t *pos) (*pos)++; - /* - * Omit labels with no associated cipso value - */ while (skp && !skp->smk_cipso) skp = skp->smk_next; @@ -336,12 +341,11 @@ static int cipso_seq_show(struct seq_file *s, void *v) int i; unsigned char m; - if (scp == NULL) - return 0; + BUG_ON(!scp); + cbp = scp->smk_catset; seq_printf(s, "%s %3d", (char *)&skp->smk_known, scp->smk_level); - cbp = scp->smk_catset; for (i = 0; i < SMK_LABELLEN; i++) for (m = 0x80; m != 0; m >>= 1) { if (m & cbp[i]) { -- Ahmed S. Darwish HomePage: http://darwish.07.googlepages.com Blog: http://darwish-07.blogspot.com - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/