From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
To: ming.lei@canonical.com, rusty@rustcorp.com.au
Cc: dhowells@redhat.com, seth.forshee@canonical.com,
torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
pebolle@tiscali.nl, linux-wireless@vger.kernel.org,
"Luis R. Rodriguez" <mcgrof@suse.com>,
Kyle McMartin <kyle@kernel.org>
Subject: [PATCH v2 1/5] firmware: fix __getname() missing failure check
Date: Tue, 12 May 2015 11:30:53 -0700 [thread overview]
Message-ID: <1431455457-25322-2-git-send-email-mcgrof@do-not-panic.com> (raw)
In-Reply-To: <1431455457-25322-1-git-send-email-mcgrof@do-not-panic.com>
From: "Luis R. Rodriguez" <mcgrof@suse.com>
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>
---
drivers/base/firmware_class.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 171841a..bc6c8e6 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,
{
int i;
int rc = -ENOENT;
- char *path = __getname();
+ char *path;
+
+ path = __getname();
+ if (unlikely(!path))
+ return PTR_ERR(path);
for (i = 0; i < ARRAY_SIZE(fw_path); i++) {
struct file *file;
--
2.3.2.209.gd67f9d5.dirty
next prev parent reply other threads:[~2015-05-12 18:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-12 18:30 [PATCH v2 0/5] firmware: few fixes for name uses Luis R. Rodriguez
2015-05-12 18:30 ` Luis R. Rodriguez [this message]
2015-05-12 20:31 ` [PATCH v2 1/5] firmware: fix __getname() missing failure check Linus Torvalds
2015-05-12 20:45 ` Luis R. Rodriguez
2015-05-12 21:21 ` Greg KH
2015-05-12 21:23 ` Luis R. Rodriguez
2015-05-12 18:30 ` [PATCH v2 2/5] firmware: check for file truncation on direct firmware loading Luis R. Rodriguez
2015-05-12 18:30 ` [PATCH v2 3/5] firmware: check for possible file truncation early Luis R. Rodriguez
2015-05-12 20:35 ` Linus Torvalds
2015-05-12 21:06 ` Luis R. Rodriguez
2015-05-12 18:30 ` [PATCH v2 4/5] firmware: fix possible use after free on name on asynchronous request Luis R. Rodriguez
2015-05-12 18:30 ` [PATCH v2 5/5] firmware: use const for remaining firmware names Luis R. Rodriguez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431455457-25322-2-git-send-email-mcgrof@do-not-panic.com \
--to=mcgrof@do-not-panic.com \
--cc=dhowells@redhat.com \
--cc=kyle@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mcgrof@suse.com \
--cc=ming.lei@canonical.com \
--cc=pebolle@tiscali.nl \
--cc=rusty@rustcorp.com.au \
--cc=seth.forshee@canonical.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®