Skip to content

Commit

Permalink
IMA: Check IMA policy flag
Browse files Browse the repository at this point in the history
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 <nramas@linux.microsoft.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
  • Loading branch information
nramas authored and mimizohar committed Dec 12, 2019
1 parent 96c9e1d commit c5563ba
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions security/integrity/ima/ima_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,9 @@ void process_buffer_measurement(const void *buf, int size,
int action = 0;
u32 secid;

if (!ima_policy_flag)
return;

/*
* Both LSM hooks and auxilary based buffer measurements are
* based on policy. To avoid code duplication, differentiate
Expand Down

0 comments on commit c5563ba

Please sign in to comment.