Skip to content

Commit

Permalink
selinux: import NetLabel category bitmaps correctly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Moore committed Jun 9, 2016
1 parent 02f0691 commit 8bebe88
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion security/selinux/ss/ebitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8bebe88

Please sign in to comment.