From: sashiko-bot@kernel.org
To: "Kees Cook" <kees@kernel.org>
Cc: dmaengine@vger.kernel.org, vkoul@kernel.org, kvm@vger.kernel.org,
linux-modules@vger.kernel.org, linux-pci@vger.kernel.org,
Frank.Li@kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH 11/11] moduleparam: Drop legacy kernel_param_ops .get_str field and dispatch logic
Date: Sat, 30 May 2026 00:46:01 +0000 [thread overview]
Message-ID: <20260530004601.82F6D1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260521133326.2465264-11-kees@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Unconditional call to `arr->ops->get()` without a NULL check can cause a kernel panic if the array parameter element lacks a `.get` callback.
--
commit a252ae87a187a5b644d160fded352c545493a611
Author: Kees Cook <kees@kernel.org>
moduleparam: Drop legacy kernel_param_ops .get_str field and dispatch logic
All struct kernel_param_ops .get callbacks have been migrated to using
struct seq_buf. Drop the migration scaffolding.
> diff --git a/kernel/params.c b/kernel/params.c
> index 25f0c8d5d19f3..6b410189297b1 100644
> --- a/kernel/params.c
> +++ b/kernel/params.c
[ ... ]
> @@ -470,23 +469,9 @@ static int param_array_get(struct seq_buf *s, const struct kernel_param *kp)
> p.arg = arr->elem + arr->elemsize * i;
> check_kparam_locked(p.mod);
>
> - if (arr->ops->get) {
> - ret = arr->ops->get(s, &p);
> - if (ret < 0)
> - goto out;
> - } else {
[ ... ]
> - }
> + ret = arr->ops->get(s, &p);
[Severity: High]
This isn't a bug introduced by this patch, but does this unconditional call to
arr->ops->get() need a NULL check to avoid a kernel panic?
If a module defines a write-only array parameter where the element's
kernel_param_ops struct lacks a .get callback, and assigns it write-only sysfs
permissions, root can still attempt to read the file. When this happens, sysfs
invokes param_attr_show().
For normal parameters, param_attr_show() has a safety check that rejects the
read if ops->get is NULL. However, for array parameters, ops resolves to
param_array_ops which has a valid .get callback, bypassing the safeguard.
Could this result in a NULL pointer dereference when arr->ops->get(s, &p) is
executed? Before this patch, the code fell back to calling .get_str(), which
would also be NULL for a write-only type, resulting in the same kernel panic.
> + if (ret < 0)
> + return ret;
>
> /* Nothing got written (e.g. overflow) — stop. */
> if (s->len == before)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260521133315.work.845-kees@kernel.org?part=11
next prev parent reply other threads:[~2026-05-30 0:46 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 13:33 [PATCH 00/11] Convert moduleparams to seq_buf Kees Cook
2026-05-21 13:33 ` [PATCH 01/11] params: bound array element output to the caller's page buffer Kees Cook
2026-05-21 16:46 ` David Laight
2026-05-21 13:33 ` [PATCH 02/11] panic: Replace panic_print_get() with generic helper Kees Cook
2026-05-21 13:33 ` [PATCH 03/11] moduleparam: Add DEFINE_KERNEL_PARAM_OPS macro family Kees Cook
2026-05-25 13:27 ` Petr Pavlu
2026-05-21 13:33 ` [PATCH 04/11] treewide: Convert struct kernel_param_ops initializers to DEFINE_KERNEL_PARAM_OPS Kees Cook
2026-05-21 13:59 ` Sean Christopherson
2026-05-22 17:01 ` Rafael J. Wysocki
2026-05-23 0:38 ` SeongJae Park
2026-05-25 13:35 ` Petr Pavlu
2026-05-21 13:33 ` [PATCH 05/11] moduleparam: Rename .get field to .get_str Kees Cook
2026-05-30 0:45 ` sashiko-bot
2026-05-21 13:33 ` [PATCH 06/11] moduleparam: Add seq_buf-based .get callback alongside .get_str Kees Cook
2026-05-25 16:19 ` Petr Pavlu
2026-05-30 0:45 ` sashiko-bot
2026-05-21 13:33 ` [PATCH 07/11] moduleparam: Route DEFINE_KERNEL_PARAM_OPS get pointer via _Generic Kees Cook
2026-05-25 16:24 ` Petr Pavlu
2026-05-21 13:33 ` [PATCH 08/11] params: Convert generic kernel_param_ops .get helpers to seq_buf Kees Cook
2026-05-25 17:10 ` Petr Pavlu
2026-05-30 0:45 ` sashiko-bot
2026-05-21 13:33 ` [PATCH 09/11] treewide: Convert custom kernel_param_ops .get callbacks to seq_buf via cocci Kees Cook
2026-05-21 13:45 ` Sean Christopherson
2026-05-22 17:03 ` Rafael J. Wysocki
2026-05-23 0:45 ` SeongJae Park
2026-05-21 13:33 ` [PATCH 10/11] treewide: Manually convert custom kernel_param_ops .get callbacks Kees Cook
2026-05-21 17:44 ` Jani Nikula
2026-05-22 17:05 ` Rafael J. Wysocki
2026-05-21 13:33 ` [PATCH 11/11] moduleparam: Drop legacy kernel_param_ops .get_str field and dispatch logic Kees Cook
2026-05-30 0:46 ` sashiko-bot [this message]
2026-05-26 6:53 ` [PATCH 00/11] Convert moduleparams to seq_buf Petr Pavlu
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=20260530004601.82F6D1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=kees@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@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