From: "Luis R. Rodriguez" <mcgrof@suse.com>
To: Greg KH <greg@kroah.com>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
ming.lei@canonical.com, rusty@rustcorp.com.au,
dhowells@redhat.com, seth.forshee@canonical.com,
torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
pebolle@tiscali.nl, linux-wireless@vger.kernel.org,
Kyle McMartin <kyle@kernel.org>
Subject: Re: [PATCH v2 1/5] firmware: fix __getname() missing failure check
Date: Tue, 12 May 2015 23:23:37 +0200 [thread overview]
Message-ID: <20150512212337.GQ23057@wotan.suse.de> (raw)
In-Reply-To: <20150512212111.GB10402@kroah.com>
On Tue, May 12, 2015 at 02:21:11PM -0700, Greg KH wrote:
> On Tue, May 12, 2015 at 11:30:53AM -0700, Luis R. Rodriguez wrote:
> > 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))
>
> Please only use likely/unlikely on code paths that actually care about
> it (i.e. you can measure the difference). Otherwise it is pretty
> useless, and people have determined that sometimes it is slower as
> humans get this wrong a lot of time...
Will do , thanks.
Luis
next prev parent reply other threads:[~2015-05-12 21:23 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 ` [PATCH v2 1/5] firmware: fix __getname() missing failure check Luis R. Rodriguez
2015-05-12 20:31 ` 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 [this message]
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=20150512212337.GQ23057@wotan.suse.de \
--to=mcgrof@suse.com \
--cc=dhowells@redhat.com \
--cc=greg@kroah.com \
--cc=kyle@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mcgrof@do-not-panic.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®