lkml.org 
[lkml]   [2007]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[PATCH] Smackv8: Omit non-cipso labels in cipso_seq_start
    From
    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 <darwish.07@gmail.com>
    ---
    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 majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2007-10-21 03:43    [W:0.023 / U:2.888 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site