netlabel: fix export of SELinux categories > 127
authorJoshua Roys <joshua.roys@gtri.gatech.edu>
Wed, 24 Feb 2010 23:52:44 +0000 (18:52 -0500)
committerJames Morris <jmorris@namei.org>
Thu, 25 Feb 2010 06:49:20 +0000 (17:49 +1100)
This fixes corrupted CIPSO packets when SELinux categories greater than 127
are used.  The bug occured on the second (and later) loops through the
while; the inner for loop through the ebitmap->maps array used the same
index as the NetLabel catmap->bitmap array, even though the NetLabel bitmap
is twice as long as the SELinux bitmap.

Signed-off-by: Joshua Roys <joshua.roys@gtri.gatech.edu>
Acked-by: Paul Moore <paul.moore@hp.com>
Signed-off-by: James Morris <jmorris@namei.org>
security/selinux/ss/ebitmap.c

index 68c7348d1acc6628f4c6121207edc34f6a7f707a..04b6145d767f96093423d5f733e6fe1b6a4e5687 100644 (file)
@@ -128,7 +128,7 @@ int ebitmap_netlbl_export(struct ebitmap *ebmap,
                        cmap_idx = delta / NETLBL_CATMAP_MAPSIZE;
                        cmap_sft = delta % NETLBL_CATMAP_MAPSIZE;
                        c_iter->bitmap[cmap_idx]
-                               |= e_iter->maps[cmap_idx] << cmap_sft;
+                               |= e_iter->maps[i] << cmap_sft;
                }
                e_iter = e_iter->next;
        }