aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/firmware_class.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@suse.com>2015-05-12 17:49:40 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-05-24 15:36:34 -0400
commitf5727b05d221796baf69667ed5c891d4bd53711e (patch)
treec6a919fa3ed296526cbbb1719810e5b2429785d7 /drivers/base/firmware_class.c
parentf4445f8b204de44a8baa4326b0e56537be867427 (diff)
firmware: fix __getname() missing failure check
The request_firmware*() APIs uses __getname() to iterate over the list of paths possible for firmware to be found, the code however never checked for failure on __getname(). Although *very unlikely*, this can still happen. Add the missing check. There is still no checks on the concatenation of the path and filename passed, that requires a bit more work and subsequent patches address this. The commit that introduced this is abb139e7 ("firmware: teach the kernel to load firmware files directly from the filesystem"). mcgrof@ergon ~/linux (git::firmware-fixes) $ git describe --contains abb139e7 v3.7-rc1~120 Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Ming Lei <ming.lei@canonical.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: David Howells <dhowells@redhat.com> Cc: Kyle McMartin <kyle@kernel.org> Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/firmware_class.c')
-rw-r--r--drivers/base/firmware_class.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 171841ad1008..49139a1ee25e 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -322,7 +322,11 @@ static int fw_get_filesystem_firmware(struct device *device,
322{ 322{
323 int i; 323 int i;
324 int rc = -ENOENT; 324 int rc = -ENOENT;
325 char *path = __getname(); 325 char *path;
326
327 path = __getname();
328 if (!path)
329 return -ENOMEM;
326 330
327 for (i = 0; i < ARRAY_SIZE(fw_path); i++) { 331 for (i = 0; i < ARRAY_SIZE(fw_path); i++) {
328 struct file *file; 332 struct file *file;