Commit 0bd172d1 authored by Kees Cook's avatar Kees Cook Committed by Zefan Li

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>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: default avatarZefan Li <lizefan@huawei.com>
parent eea5a87d
......@@ -588,6 +588,9 @@ request_firmware(const struct firmware **firmware_p, const char *name,
struct firmware_priv *fw_priv;
int ret;
if (!name || name[0] == '\0')
return -EINVAL;
fw_priv = _request_firmware_prepare(firmware_p, name, device, true,
false);
if (IS_ERR_OR_NULL(fw_priv))
......
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