summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladis Dronov <vdronov@redhat.com>2020-03-08 11:08:55 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-20 12:54:20 +0300
commit02f13e4e682390d10d7ece6260d9ee4059c8f450 (patch)
treea9db89ca211358ec5eb51efc158b71935258d3b0
parent5a09fc5060754baf59b28cf92719a776d1c3bfbd (diff)
downloadlinux-02f13e4e682390d10d7ece6260d9ee4059c8f450.tar.xz
efi: Add a sanity check to efivar_store_raw()
commit d6c066fda90d578aacdf19771a027ed484a79825 upstream. Add a sanity check to efivar_store_raw() the same way efivar_{attr,size,data}_read() and efivar_show_raw() have it. Signed-off-by: Vladis Dronov <vdronov@redhat.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20200305084041.24053-3-vdronov@redhat.com Link: https://lore.kernel.org/r/20200308080859.21568-25-ardb@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/firmware/efi/efivars.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c
index c8688490f148..1c65f5ac4368 100644
--- a/drivers/firmware/efi/efivars.c
+++ b/drivers/firmware/efi/efivars.c
@@ -272,6 +272,9 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count)
u8 *data;
int err;
+ if (!entry || !buf)
+ return -EINVAL;
+
if (is_compat()) {
struct compat_efi_variable *compat;