From: sashiko-bot@kernel.org
To: "Coiby Xu" <coiby.xu@gmail.com>
Cc: "Dave Young" <ruirui.yang@linux.dev>,
"Mike Rapoport" <rppt@kernel.org>,
kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org,
"Sourabh Jain" <sourabhjain@linux.ibm.com>,
"Baoquan He" <baoquan.he@linux.dev>,
"Pratyush Yadav" <pratyush@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Jinjie Ruan" <ruanjinjie@huawei.com>,
"Pasha Tatashin" <pasha.tatashin@soleen.com>,
"open list" <linux-kernel@vger.kernel.org>,
"Will Deacon" <will@kernel.org>
Subject: Re: [PATCH v5 6/9] crash_dump: Improve readability of config_keys_restore_store
Date: Wed, 09 Sep 2026 00:45:34 +0000 [thread overview]
Message-ID: <20260909004535.2660B1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260909003657.1570544-7-coiby.xu@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The local variable `r` is returned uninitialized when the user writes a value evaluating to false.
--
commit 22a99a886bc0e01618cd42c5f2b503de86fa5a10
Author: Coiby Xu <coiby.xu@gmail.com>
crash_dump: Improve readability of config_keys_restore_store
This commit introduces user input validation to config_keys_restore_store
before restoring dm-crypt keys. It ensures the restore function's return
code is verified and improves overall code readability.
> diff --git a/kernel/crash_dump_dm_crypt.c b/kernel/crash_dump_dm_crypt.c
> index 9ad50ac54866a..b8fe630462cfa 100644
> --- a/kernel/crash_dump_dm_crypt.c
> +++ b/kernel/crash_dump_dm_crypt.c
> @@ -371,13 +371,25 @@ static ssize_t config_keys_restore_show(struct config_item *item, char *page)
> static ssize_t config_keys_restore_store(struct config_item *item,
> const char *page, size_t count)
> {
> - if (!restore)
> - restore_dm_crypt_keys_to_thread_keyring();
> + bool val;
> + int r;
>
> - if (kstrtobool(page, &restore))
> + if (kstrtobool(page, &val))
> return -EINVAL;
>
> - return count;
> + if (val) {
> + if (restore) {
> + pr_warn("dm-crypt keys already restored!\n");
> + return count;
> + }
> + r = restore_dm_crypt_keys_to_thread_keyring();
> + if (!r) {
> + restore = true;
> + r = count;
> + }
> + }
> +
[Severity: High]
If a user writes a value evaluating to false (e.g., '0' or 'n') to this
configfs attribute, kstrtobool() will succeed and set val to false.
This causes the if (val) block to be bypassed entirely, resulting in the
uninitialized variable r being returned here. Could this leak uninitialized
kernel stack memory to userspace or cause undefined behavior?
> + return r;
> }
>
> CONFIGFS_ATTR(config_keys_, restore);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260909003657.1570544-1-coiby.xu@gmail.com?part=6
next prev parent reply other threads:[~2026-09-09 0:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260909003657.1570544-1-coiby.xu@gmail.com>
2026-09-09 0:36 ` [PATCH v5 1/9] crash_dump: Fix potential double free and UAF of keys_header Coiby Xu
2026-09-09 0:53 ` sashiko-bot
2026-09-09 13:27 ` Coiby Xu
2026-09-09 0:36 ` [PATCH v5 2/9] crash_dump: Read the number of dm-crypt keys from reserved memory Coiby Xu
2026-09-09 0:52 ` sashiko-bot
2026-09-09 0:36 ` [PATCH v5 3/9] crash_dump: Disallow writing to dm-crypt configfs during kexec_file_load syscall Coiby Xu
2026-09-09 0:47 ` sashiko-bot
2026-09-09 13:29 ` Coiby Xu
2026-09-09 0:36 ` [PATCH v5 4/9] crash_dump: Free temporary dm-crypt keys_header buffer in kdump kernel Coiby Xu
2026-09-09 0:46 ` sashiko-bot
2026-09-09 0:36 ` [PATCH v5 5/9] crash_dump: Only use kexec_dprintk during the kexec_file_load syscall Coiby Xu
2026-09-09 0:47 ` sashiko-bot
2026-09-09 0:36 ` [PATCH v5 6/9] crash_dump: Improve readability of config_keys_restore_store Coiby Xu
2026-09-09 0:45 ` sashiko-bot [this message]
2026-09-09 0:36 ` [PATCH v5 7/9] crash_dump: Check the function return codes in restore_dm_crypt_keys_to_thread_keyring Coiby Xu
2026-09-09 0:49 ` sashiko-bot
2026-09-09 0:36 ` [PATCH v5 8/9] crash_dump: Disallow configfs/crash_dm_crypt_key/reuse if crash hotplug supported Coiby Xu
2026-09-09 0:53 ` sashiko-bot
2026-09-09 5:46 ` Randy Dunlap
2026-09-09 13:33 ` Coiby Xu
2026-09-09 0:36 ` [PATCH v5 9/9] Documentation: kdump: Add arm64 and ppc64le to encrypted dump target support list Coiby Xu
2026-09-09 0:38 ` sashiko-bot
2026-09-09 5:48 ` Randy Dunlap
2026-09-09 13:34 ` Coiby Xu
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=20260909004535.2660B1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baoquan.he@linux.dev \
--cc=coiby.xu@gmail.com \
--cc=kexec@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=rppt@kernel.org \
--cc=ruanjinjie@huawei.com \
--cc=ruirui.yang@linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sourabhjain@linux.ibm.com \
--cc=will@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
all inboxes | Powered by JetHome®