summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2014-09-18 11:25:37 -0700
committerBen Hutchings <ben@decadent.org.uk>2014-12-14 16:23:43 +0000
commit21636a4d34b572b91568259c489d72394302ef71 (patch)
tree67bfaf78e99701154306e9c8b5b91f198a791268 /drivers/base
parent43e986b5196b31b7c020a381b6f8dc3196f8a4ad (diff)
firmware_class: make sure fw requests contain a name
commit 471b095dfe0d693a8d624cbc716d1ee4d74eb437 upstream. An empty firmware request name will trigger warnings when building device names. Make sure this is caught earlier and rejected. The warning was visible via the test_firmware.ko module interface: echo -ne "\x00" > /sys/devices/virtual/misc/test_firmware/trigger_request Reported-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Kees Cook <keescook@chromium.org> Tested-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> [bwh: Backported to 3.2: adjust context] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/firmware_class.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 3719c94be19c..763b35618edb 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -521,6 +521,9 @@ static int _request_firmware(const struct firmware **firmware_p,
if (!firmware_p)
return -EINVAL;
+ if (!name || name[0] == '\0')
+ return -EINVAL;
+
*firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL);
if (!firmware) {
dev_err(device, "%s: kmalloc(struct firmware) failed\n",