Skip to content

Commit c5563ba

Browse files
nramasmimizohar
authored andcommitted
IMA: Check IMA policy flag
process_buffer_measurement() may be called prior to IMA being initialized (for instance, when the IMA hook is called when a key is added to the .builtin_trusted_keys keyring), which would result in a kernel panic. This patch adds the check in process_buffer_measurement() to return immediately if IMA is not initialized yet. Signed-off-by: Lakshmi Ramasubramanian <[email protected]> Signed-off-by: Mimi Zohar <[email protected]>
1 parent 96c9e1d commit c5563ba

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

security/integrity/ima/ima_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,9 @@ void process_buffer_measurement(const void *buf, int size,
655655
int action = 0;
656656
u32 secid;
657657

658+
if (!ima_policy_flag)
659+
return;
660+
658661
/*
659662
* Both LSM hooks and auxilary based buffer measurements are
660663
* based on policy. To avoid code duplication, differentiate

0 commit comments

Comments
 (0)