diff options
author | Lakshmi Ramasubramanian <nramas@linux.microsoft.com> | 2019-12-11 17:47:02 +0100 |
---|---|---|
committer | Mimi Zohar <zohar@linux.ibm.com> | 2019-12-12 14:53:50 +0100 |
commit | c5563bad88e07017e08cce1142903e501598c80c (patch) | |
tree | 61b6b5e8886362274b1b97e46e3be309762bacb9 /security/integrity/ima/ima_main.c | |
parent | ima: avoid appraise error for hash calc interrupt (diff) | |
download | linux-c5563bad88e07017e08cce1142903e501598c80c.tar.xz linux-c5563bad88e07017e08cce1142903e501598c80c.zip |
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 <nramas@linux.microsoft.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Diffstat (limited to 'security/integrity/ima/ima_main.c')
-rw-r--r-- | security/integrity/ima/ima_main.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index d7e987baf127..9b35db2fc777 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c @@ -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 |