From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
To: ming.lei@canonical.com, rusty@rustcorp.com.au
Cc: torvalds@linux-foundation.org, dhowells@redhat.com,
seth.forshee@canonical.com, linux-kernel@vger.kernel.org,
pebolle@tiscali.nl, linux-wireless@vger.kernel.org,
gregkh@linuxfoundation.org, jlee@suse.com, tiwai@suse.de,
"Luis R. Rodriguez" <mcgrof@suse.com>,
Kyle McMartin <kyle@kernel.org>
Subject: [PATCH v3 1/4] firmware: fix __getname() missing failure check
Date: Tue, 12 May 2015 14:49:40 -0700 [thread overview]
Message-ID: <1431467383-28540-2-git-send-email-mcgrof@do-not-panic.com> (raw)
In-Reply-To: <1431467383-28540-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..49139a1 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 (!path)
+ return -ENOMEM;
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 21:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-12 21:49 [PATCH v3 0/4] firmware: few fixes for name uses Luis R. Rodriguez
2015-05-12 21:49 ` Luis R. Rodriguez [this message]
2015-05-12 21:49 ` [PATCH v3 2/4] firmware: check for file truncation on direct firmware loading Luis R. Rodriguez
2015-05-12 21:49 ` [PATCH v3 3/4] firmware: fix possible use after free on name on asynchronous request Luis R. Rodriguez
2015-05-12 21:49 ` [PATCH v3 4/4] firmware: use const for remaining firmware names Luis R. Rodriguez
2015-05-19 16:45 ` [PATCH v3 0/4] firmware: few fixes for name uses Luis R. Rodriguez
2015-05-19 17:05 ` Greg KH
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=1431467383-28540-2-git-send-email-mcgrof@do-not-panic.com \
--to=mcgrof@do-not-panic.com \
--cc=dhowells@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=jlee@suse.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=tiwai@suse.de \
--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