Skip to content

Commit 8bebe88

Browse files
committed
selinux: import NetLabel category bitmaps correctly
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>
1 parent 02f0691 commit 8bebe88

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

security/selinux/ss/ebitmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ int ebitmap_netlbl_import(struct ebitmap *ebmap,
165165
e_iter = kzalloc(sizeof(*e_iter), GFP_ATOMIC);
166166
if (e_iter == NULL)
167167
goto netlbl_import_failure;
168-
e_iter->startbit = offset & ~(EBITMAP_SIZE - 1);
168+
e_iter->startbit = offset - (offset % EBITMAP_SIZE);
169169
if (e_prev == NULL)
170170
ebmap->node = e_iter;
171171
else

0 commit comments

Comments
 (0)