From: Jeff Layton <jlayton@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>,
Russ Weight <russ.weight@linux.dev>,
Danilo Krummrich <dakr@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Shuah Khan <shuah@kernel.org>, Michal Grzedzicki <mge@meta.com>,
driver-core@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v6 0/2] firmware_loader: allow firmware_class.path to take multiple paths
Date: Thu, 02 Apr 2026 12:51:41 -0400 [thread overview]
Message-ID: <864853a212fe7a7b57cca907a57174d3ca3faeaa.camel@kernel.org> (raw)
In-Reply-To: <2026040212-passivism-stimuli-2670@gregkh>
On Thu, 2026-04-02 at 06:13 +0200, Greg Kroah-Hartman wrote:
> On Wed, Apr 01, 2026 at 09:43:26AM -0400, Jeff Layton wrote:
> > This is something Michal had asked for last year, and I just got around
> > to implementing. This version is just a minor cleanup for
> > reviewability's sake. I also renamed the search= option to search_path=.
> >
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
>
> While it is still experimental, and might not be fully correct, you
> might want to look here:
> https://sashiko.dev/#/patchset/20260401-fw-path-v6-0-4ebe70441839%40kernel.org
> to see a few potential issues for this patchset (notibly at least the
> bash stuff)
>
I'll plan to fix up the bash ones.
This race in the C review looks legit too:
------------------8<-------------------
-
> + /* Try the customized path first */
> + if (fw_path_para[0]) {
> + int dirlen = strlen(fw_path_para);
>
> - fw_priv->size = 0;
> + /* strip trailing newline */
> + if (fw_path_para[dirlen - 1] == '\n')
> + dirlen--;
Can a concurrent sysfs write cause an out-of-bounds read here?
If a sysfs write clears the string (e.g., by echoing an empty string to the
path parameter) immediately after the if (fw_path_para[0]) check,
strlen(fw_path_para) could return 0.
This would cause the code to evaluate fw_path_para[-1] == '\n', accessing
memory before the array bounds.
------------------8<-------------------
My reviews with Claude noticed the first race too, but I had concluded
that it was benign (you'd get a failed firmware load, but it shouldn't
crash).
I think that the simplest fix would be to just add a global rwsem
around the get/set routines. I'll plan to send a v7.
Thanks for the pointer!
--
Jeff Layton <jlayton@kernel.org>
prev parent reply other threads:[~2026-04-02 16:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 13:43 [PATCH v6 0/2] firmware_loader: allow firmware_class.path to take multiple paths Jeff Layton
2026-04-01 13:43 ` [PATCH v6 1/2] firmware_loader: add search_path= module option for multi-path firmware lookup Jeff Layton
2026-04-01 13:43 ` [PATCH v6 2/2] selftests/firmware: add search path test for firmware_class.search_path= Jeff Layton
2026-04-02 4:13 ` [PATCH v6 0/2] firmware_loader: allow firmware_class.path to take multiple paths Greg Kroah-Hartman
2026-04-02 16:51 ` Jeff Layton [this message]
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=864853a212fe7a7b57cca907a57174d3ca3faeaa.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=mge@meta.com \
--cc=rafael@kernel.org \
--cc=russ.weight@linux.dev \
--cc=shuah@kernel.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