[PATCH] ima: free the restored template entry on error in ima_restore_measurement_list()

sashiko-bot at kernel.org sashiko-bot at kernel.org
Fri Nov 27 07:38:04 UTC 2026


> ima_restore_template_data() allocates a template entry that the caller
> owns once it returns success. ima_restore_measurement_list() breaks out
> of its loop without freeing it when ima_calc_field_array_hash() fails
> or when ima_restore_measurement_entry() fails, so the entry, its digests
> and its field data are leaked.
> 
> Free the entry with ima_free_template_entry() on both paths.
> 
> Fixes: 1ea973df6e21 ("ima: Calculate and extend PCR with digests in ima_template_entry")
> Fixes: 94c3aac567a9 ("ima: on soft reboot, restore the measurement list")
> Signed-off-by: Cong Nguyen <congnt264 at gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127073233.181925-1-congnt264@gmail.com?part=1



More information about the Linux-security-module-archive mailing list