]> git.itanic.dy.fi Git - linux-stable/commit
efi: random: Properly limit the size of the random seed
authorBen Hutchings <ben@decadent.org.uk>
Wed, 30 Nov 2022 23:47:22 +0000 (00:47 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Dec 2022 10:16:33 +0000 (11:16 +0100)
commit4ddc92bfada05ad440692fea6ab8b80c3d97cfcd
treea6833e90ac88babec20d974b3fc48e115c0727c6
parenta6d363d48a816877d9f9d12da8fc5ed786e333b8
efi: random: Properly limit the size of the random seed

Commit be36f9e7517e ("efi: READ_ONCE rng seed size before munmap")
added a READ_ONCE() and also changed the call to
add_bootloader_randomness() to use the local size variable.  Neither
of these changes was actually needed and this was not backported to
the 4.14 stable branch.

Commit 161a438d730d ("efi: random: reduce seed size to 32 bytes")
reverted the addition of READ_ONCE() and added a limit to the value of
size.  This depends on the earlier commit, because size can now differ
from seed->size, but it was wrongly backported to the 4.14 stable
branch by itself.

Apply the missing change to the add_bootloader_randomness() parameter
(except that here we are still using add_device_randomness()).

Fixes: 700485f70e50 ("efi: random: reduce seed size to 32 bytes")
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/firmware/efi/efi.c