From: "Luis R. Rodriguez" <mcgrof@suse.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
Ming Lei <ming.lei@canonical.com>,
Rusty Russell <rusty@rustcorp.com.au>,
David Howells <dhowells@redhat.com>,
Seth Forshee <seth.forshee@canonical.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Paul Bolle <pebolle@tiscali.nl>,
Linux Wireless List <linux-wireless@vger.kernel.org>,
Kyle McMartin <kyle@kernel.org>
Subject: Re: [PATCH v2 3/5] firmware: check for possible file truncation early
Date: Tue, 12 May 2015 23:06:21 +0200 [thread overview]
Message-ID: <20150512210621.GP23057@wotan.suse.de> (raw)
In-Reply-To: <CA+55aFxQhGLtwEdtKcQLh2CLE5-hM-o-4=mWj3sB6rKgCmdSKQ@mail.gmail.com>
On Tue, May 12, 2015 at 01:35:59PM -0700, Linus Torvalds wrote:
> On Tue, May 12, 2015 at 11:30 AM, Luis R. Rodriguez
> <mcgrof@do-not-panic.com> wrote:
> >
> > Instead of waiting until the last second to fail
> > on a request_firmware*() calls due to filename
> > truncation we can do an early check upon boot
> > and immediatley avoid any possible issues upfront.
>
> Why? This looks stupid. Why add this special case, when normal path
> lookup results in the proper errors
It seemed silly to proceed late if we can catch the possible name errors
early. It does indeed have the cost of all that early cruft code.
> And if invalid pathnames are so frequent that this special case is
> somehow worth it, we should fix whoever generates that crap, instead
> of adding this insane special case.
OK, I'm all for ignoring non-upstream drivers.
> And if we don't handle the errors from normal path lookup properly,
> then we should fix *that*.
That was done on patch 2, originally I was going for a simple early
check which can be put on all API calls prior to doing anything too
intrusive:
+static int sysdata_validate_filename(const char *name)
+{
+ if (!name)
+ return -EINVAL;
+ /* POSIX.1 2.4: an empty pathname is invalid, match other checks */
+ if (name[0] == '\0')
+ return -ENOENT;
+}
Since the truncation was possible too though it seemed worthy to add given
that quite a few callers can end up re-using the same code.
> In other words, I see absolutely no reason for this patch. Regardless
> of the reason for it, it seems entirely broken.
OK I'll get rid of all these early checks.
Luis
next prev parent reply other threads:[~2015-05-12 21:06 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
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 [this message]
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=20150512210621.GP23057@wotan.suse.de \
--to=mcgrof@suse.com \
--cc=dhowells@redhat.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®