linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firmware_class: make sure fw requests contain a name
@ 2014-09-18 18:25 Kees Cook
  2014-09-18 19:44 ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2014-09-18 18:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ming Lei, Greg Kroah-Hartman, Sasha Levin

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>
Cc: stable@vger.kernel.org
---
 drivers/base/firmware_class.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index bf424305f3dc..3d785ebb48d3 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -1105,6 +1105,9 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
 	if (!firmware_p)
 		return -EINVAL;
 
+	if (!name || name[0] == '\0')
+		return -EINVAL;
+
 	ret = _request_firmware_prepare(&fw, name, device);
 	if (ret <= 0) /* error or already assigned */
 		goto out;
-- 
1.9.1


-- 
Kees Cook
Chrome OS Security

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] firmware_class: make sure fw requests contain a name
  2014-09-18 18:25 [PATCH] firmware_class: make sure fw requests contain a name Kees Cook
@ 2014-09-18 19:44 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2014-09-18 19:44 UTC (permalink / raw)
  To: Kees Cook, linux-kernel; +Cc: Ming Lei, Greg Kroah-Hartman

On 09/18/2014 02:25 PM, Kees Cook wrote:
> 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>
> Cc: stable@vger.kernel.org

Works for me!

	Tested-by: Sasha Levin <sasha.levin@oracle.com>


Thanks,
Sasha

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-18 19:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-18 18:25 [PATCH] firmware_class: make sure fw requests contain a name Kees Cook
2014-09-18 19:44 ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).