Skip to content
Snippets Groups Projects
Commit ead7ad4b authored by Waiman Long's avatar Waiman Long Committed by Yang Yingliang
Browse files

mm/slab: use memzero_explicit() in kzfree()

stable inclusion
from linux-4.19.131
commit 9ac47ed7c9090e0fd60b7a67f5611573b1410a95

--------------------------------

commit 8982ae52 upstream.

The kzfree() function is normally used to clear some sensitive
information, like encryption keys, in the buffer before freeing it back to
the pool.  Memset() is currently used for buffer clearing.  However
unlikely, there is still a non-zero probability that the compiler may
choose to optimize away the memory clearing especially if LTO is being
used in the future.

To make sure that this optimization will never happen,
memzero_explicit(), which is introduced in v3.18, is now used in
kzfree() to future-proof it.

Link: http://lkml.kernel.org/r/20200616154311.12314-2-longman@redhat.com


Fixes: 3ef0e5ba ("slab: introduce kzfree()")
Signed-off-by: default avatarWaiman Long <longman@redhat.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Jarkko Sakkinen <jarkko....
parent 7bab2bb2
No related branches found
No related tags found
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment