Patch "ima: Fix potential memory leak in ima_init_crypto()" has been added to the 5.18-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ima: Fix potential memory leak in ima_init_crypto()

to the 5.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ima-fix-potential-memory-leak-in-ima_init_crypto.patch
and it can be found in the queue-5.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a14b83618a587bf150e0fe17202559c7d59eaea3
Author: Jianglei Nie <niejianglei2021@xxxxxxx>
Date:   Tue Jul 12 09:10:37 2022 +0800

    ima: Fix potential memory leak in ima_init_crypto()
    
    [ Upstream commit 067d2521874135267e681c19d42761c601d503d6 ]
    
    On failure to allocate the SHA1 tfm, IMA fails to initialize and exits
    without freeing the ima_algo_array. Add the missing kfree() for
    ima_algo_array to avoid the potential memory leak.
    
    Signed-off-by: Jianglei Nie <niejianglei2021@xxxxxxx>
    Fixes: 6d94809af6b0 ("ima: Allocate and initialize tfm for each PCR bank")
    Signed-off-by: Mimi Zohar <zohar@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c
index a7206cc1d7d1..64499056648a 100644
--- a/security/integrity/ima/ima_crypto.c
+++ b/security/integrity/ima/ima_crypto.c
@@ -205,6 +205,7 @@ int __init ima_init_crypto(void)
 
 		crypto_free_shash(ima_algo_array[i].tfm);
 	}
+	kfree(ima_algo_array);
 out:
 	crypto_free_shash(ima_shash_tfm);
 	return rc;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux