[dm-crypt] Memory leak when using openssl backend

Milan Broz gmazyland at gmail.com
Tue Oct 11 11:53:00 CEST 2016


On 10/11/2016 10:58 AM, Per Johansson wrote:
> I have found a memory leak when using openssl backend. I don't know if 
> this is the proper way to report it.

Hi,

yes, it is one of ways how to report it (you can use gitlab issues as well).

Thanks for report! (I'll handle that patch in upstream git later this week.)

BTW Do you use some automated tool to find such problems or it was random find?

Milan


> The problem is that crypt_hash_init() and crypt_hash_restart() calls 
> EVP_DigestInit() but  crypt_hash_final() calls EVP_DigestFinal_ex(). 
> This results in that the context struct is zeroed when 
> crypt_hash_restart() calls EVP_DigestInit(), and the memory allocated by 
> the previous call to EVP_DigestInit() is lost. The version of openssl we 
> use is 1.0.2g. This leak might not occur in later versions of openssl 
> that has changed how those functions work.
> 
> I have attached a suggested fix that only uses the _ex versions of the 
> EVP functions.
> 
> 
> /Per
> 
> 
> 
> _______________________________________________
> dm-crypt mailing list
> dm-crypt at saout.de
> http://www.saout.de/mailman/listinfo/dm-crypt
> 


More information about the dm-crypt mailing list