[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1395259200-27732-3-git-send-email-matt@console-pimps.org>
Date: Wed, 19 Mar 2014 19:59:57 +0000
From: Matt Fleming <matt@...sole-pimps.org>
To: linux-efi@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Matt Fleming <matt.fleming@...el.com>
Subject: [PATCH 2/5] efivars: Check size of user object
From: Matt Fleming <matt.fleming@...el.com>
Unbelieavably there are no checks to see whether the data structure
passed to 'new_var' and 'del_var' is the size that we expect. Let's add
some for better robustness.
Signed-off-by: Matt Fleming <matt.fleming@...el.com>
---
drivers/firmware/efi/efivars.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c
index 06ec6ee1c58a..2c21cccc2572 100644
--- a/drivers/firmware/efi/efivars.c
+++ b/drivers/firmware/efi/efivars.c
@@ -347,6 +347,9 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj,
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
+ if (count != sizeof(*new_var))
+ return -EINVAL;
+
attributes = new_var->Attributes;
size = new_var->DataSize;
data = new_var->Data;
@@ -395,6 +398,9 @@ static ssize_t efivar_delete(struct file *filp, struct kobject *kobj,
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
+ if (count != sizeof(*del_var))
+ return -EINVAL;
+
name = del_var->VariableName;
vendor = del_var->VendorGuid;
--
1.8.5.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists