]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
apparmor: ensure WB_HISTORY_SIZE value is a power of 2
authorRyan Lee <ryan.lee@canonical.com>
Thu, 1 May 2025 19:54:38 +0000 (12:54 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:08:57 +0000 (12:08 +0200)
commitfad01f7e0d3e36dab061061e6ce74e250b9e63e1
treeaa4878b4379c3758a047cd9bc0f281195bc9e997
parent4795bcafe9a80a2bfc9381b99e950c30d462316c
apparmor: ensure WB_HISTORY_SIZE value is a power of 2

[ Upstream commit 6c055e62560b958354625604293652753d82bcae ]

WB_HISTORY_SIZE was defined to be a value not a power of 2, despite a
comment in the declaration of struct match_workbuf stating it is and a
modular arithmetic usage in the inc_wb_pos macro assuming that it is. Bump
WB_HISTORY_SIZE's value up to 32 and add a BUILD_BUG_ON_NOT_POWER_OF_2
line to ensure that any future changes to the value of WB_HISTORY_SIZE
respect this requirement.

Fixes: 136db994852a ("apparmor: increase left match history buffer size")
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
security/apparmor/include/match.h
security/apparmor/match.c