]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
selinux: import NetLabel category bitmaps correctly
authorPaul Moore <paul@paul-moore.com>
Thu, 9 Jun 2016 14:40:37 +0000 (10:40 -0400)
committerPaul Moore <paul@paul-moore.com>
Thu, 9 Jun 2016 14:40:37 +0000 (10:40 -0400)
The existing ebitmap_netlbl_import() code didn't correctly handle the
case where the ebitmap_node was not aligned/sized to a power of two,
this patch fixes this (on x86_64 ebitmap_node contains six bitmaps
making a range of 0..383).

Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/ss/ebitmap.c

index 57644b1dc42e1a38b5f1fd0d24ab75164b3bdbf1..894b6cdc11c5410591aaf46a3170eeea13dc444a 100644 (file)
@@ -165,7 +165,7 @@ int ebitmap_netlbl_import(struct ebitmap *ebmap,
                        e_iter = kzalloc(sizeof(*e_iter), GFP_ATOMIC);
                        if (e_iter == NULL)
                                goto netlbl_import_failure;
-                       e_iter->startbit = offset & ~(EBITMAP_SIZE - 1);
+                       e_iter->startbit = offset - (offset % EBITMAP_SIZE);
                        if (e_prev == NULL)
                                ebmap->node = e_iter;
                        else