Commit 21636a4d authored by Kees Cook's avatar Kees Cook Committed by Ben Hutchings

firmware_class: make sure fw requests contain a name

commit 471b095d 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: default avatarSasha Levin <sasha.levin@oracle.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Tested-by: default avatarSasha Levin <sasha.levin@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 43e986b5
...@@ -521,6 +521,9 @@ static int _request_firmware(const struct firmware **firmware_p, ...@@ -521,6 +521,9 @@ static int _request_firmware(const struct firmware **firmware_p,
if (!firmware_p) if (!firmware_p)
return -EINVAL; return -EINVAL;
if (!name || name[0] == '\0')
return -EINVAL;
*firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL); *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL);
if (!firmware) { if (!firmware) {
dev_err(device, "%s: kmalloc(struct firmware) failed\n", dev_err(device, "%s: kmalloc(struct firmware) failed\n",
......
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