Commit 47537bce authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

ila_xlat: add missing hash secret initialization

commit 0db47e3d upstream.

While discussing the possible merits of clang warning about unused initialized
functions, I found one function that was clearly meant to be called but
never actually is.

__ila_hash_secret_init() initializes the hash value for the ila locator,
apparently this is intended to prevent hash collision attacks, but this ends
up being a read-only zero constant since there is no caller. I could find
no indication of why it was never called, the earliest patch submission
for the module already was like this. If my interpretation is right, we
certainly want to backport the patch to stable kernels as well.

I considered adding it to the ila_xlat_init callback, but for best effect
the random data is read as late as possible, just before it is first used.
The underlying net_get_random_once() is already highly optimized to avoid
overhead when called frequently.

Fixes: 7f00feaf ("ila: Add generic ILA translation facility")
Link: https://www.spinics.net/lists/kernel/msg2527243.htmlSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 95f47cd7
...@@ -68,6 +68,7 @@ static inline u32 ila_locator_hash(struct ila_locator loc) ...@@ -68,6 +68,7 @@ static inline u32 ila_locator_hash(struct ila_locator loc)
{ {
u32 *v = (u32 *)loc.v32; u32 *v = (u32 *)loc.v32;
__ila_hash_secret_init();
return jhash_2words(v[0], v[1], hashrnd); return jhash_2words(v[0], v[1], hashrnd);
} }
......
Markdown is supported
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