From: "Luis R. Rodriguez" <mcgrof@suse.com>
To: Kees Cook <keescook@chromium.org>, David Howells <dhowells@redhat.com>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
Ming Lei <ming.lei@canonical.com>,
seth.forshee@canonical.com, Rusty Russell <rusty@rustcorp.com.au>,
Linus Torvalds <torvalds@linux-foundation.org>,
David Howells <dhowells@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
Paul Bolle <pebolle@tiscali.nl>,
linux-wireless <linux-wireless@vger.kernel.org>,
Greg KH <gregkh@linuxfoundation.org>,
jlee@suse.com, Takashi Iwai <tiwai@suse.de>,
Casey Schaufler <casey@schaufler-ca.com>,
Matthew Garrett <mjg59@srcf.ucam.org>,
Andrew Morton <akpm@linux-foundation.org>,
Kyle McMartin <kyle@kernel.org>,
David Woodhouse <David.Woodhouse@intel.com>
Subject: Re: [RFC v3 2/2] firmware: add firmware signature checking support
Date: Tue, 14 Jul 2015 21:20:15 +0200 [thread overview]
Message-ID: <20150714192015.GO7021@wotan.suse.de> (raw)
In-Reply-To: <CAGXu5jJnPqgpvXd05-dtSbYeSVndcpH1_XMMczPWn5Gq-DUtcw@mail.gmail.com>
On Mon, Jun 08, 2015 at 12:56:44PM -0700, Kees Cook wrote:
> On Mon, May 18, 2015 at 5:45 PM, Luis R. Rodriguez
> <mcgrof@do-not-panic.com> wrote:
> > From: "Luis R. Rodriguez" <mcgrof@suse.com>
> >
> > diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> > index 134dd77..97cab65 100644
> > --- a/drivers/base/firmware_class.c
> > +++ b/drivers/base/firmware_class.c
> > @@ -180,17 +190,33 @@ static struct firmware_buf *__allocate_fw_buf(const char *fw_name,
> > struct firmware_cache *fwc)
> > {
> > struct firmware_buf *buf;
> > + const char *sign_ext = ".p7s";
> > + char *signed_name;
> > +
> > + signed_name = kzalloc(PATH_MAX, GFP_ATOMIC);
> > + if (!signed_name)
> > + return NULL;
> >
> > buf = kzalloc(sizeof(*buf), GFP_ATOMIC);
> > - if (!buf)
> > + if (!buf) {
> > + kfree(signed_name);
> > return NULL;
> > + }
> >
> > buf->fw_id = kstrdup_const(fw_name, GFP_ATOMIC);
> > if (!buf->fw_id) {
> > + kfree(signed_name);
> > kfree(buf);
> > return NULL;
> > }
> >
> > + strcpy(signed_name, buf->fw_id);
> > + strncat(signed_name, sign_ext, strlen(sign_ext));
>
> fw_id is potentially unbounded, so using strncat hear poses an
> overflow risk. Maybe better to use strlcpy?
>
Thanks for the feedback, indeed.
Luis
next prev parent reply other threads:[~2015-07-14 19:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-19 0:45 [RFC v3 0/2] firmware: add PKCS#7 firmware signature support Luis R. Rodriguez
2015-05-19 0:45 ` [RFC v3 1/2] firmware: generalize reading file contents as a helper Luis R. Rodriguez
2015-05-19 0:45 ` [RFC v3 2/2] firmware: add firmware signature checking support Luis R. Rodriguez
2015-06-08 19:56 ` Kees Cook
2015-07-14 19:20 ` Luis R. Rodriguez [this message]
2015-07-21 23:14 ` Luis R. Rodriguez
2015-05-19 9:33 ` David Howells
2015-05-19 16:23 ` Luis R. Rodriguez
2015-05-19 10:02 ` David Howells
2015-05-19 16:31 ` Luis R. Rodriguez
2015-05-22 15:21 ` [RFC v3 0/2] firmware: add PKCS#7 firmware signature support David Howells
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=20150714192015.GO7021@wotan.suse.de \
--to=mcgrof@suse.com \
--cc=David.Woodhouse@intel.com \
--cc=akpm@linux-foundation.org \
--cc=casey@schaufler-ca.com \
--cc=dhowells@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=jlee@suse.com \
--cc=keescook@chromium.org \
--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=mjg59@srcf.ucam.org \
--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;
as well as URLs for NNTP newsgroup(s).