From: sashiko-bot@kernel.org
To: shao.mingyin@zte.com.cn, linux-nvme@lists.infradead.org
Subject: Re: [PATCH] nvmet: fix the CSTS state iteration in debugfs
Date: Sat, 14 Nov 2026 17:32:58 +0000 [thread overview]
Message-ID: <sashiko-outbox-214841@kernel.org> (raw)
In-Reply-To: <20261115012806699yIujDZo6TywlxuhhSIktO@zte.com.cn>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Medium] nvmet: data race in nvmet_ctrl_kato_show() [1]
--
commit 7730565aae4019e36ef00daab9fa6f3d654b6597
Author: Shao Mingyin <shao.mingyin@zte.com.cn>
nvmet: fix the CSTS state iteration in debugfs
This commit fixes nvmet_ctrl_state_show() to iterate over the 32 bits of
csts instead of the size of csts_state_names[], checking array bounds and
printing unknown bits as unsigned values.
> diff --git a/drivers/nvme/target/debugfs.c b/drivers/nvme/target/debugfs.c
> index e85fe1d4c9f8d..905a08c63669e 100644
> --- a/drivers/nvme/target/debugfs.c
> +++ b/drivers/nvme/target/debugfs.c
> @@ -78,18 +78,19 @@ static int nvmet_ctrl_state_show(struct seq_file *m, void *p)
> bool sep = false;
> int i;
>
> - for (i = 0; i < ARRAY_SIZE(csts_state_names); i++) {
> - int state = BIT(i);
> + for (i = 0; i < BITS_PER_TYPE(u32); i++) {
> + u32 state = BIT(i);
>
> if (!(ctrl->csts & state))
> continue;
[Severity: Medium]
This problem wasn't introduced by this patch, but can reading ctrl->csts
across loop iterations in nvmet_ctrl_state_show() (as well as ctrl->kato
in nvmet_ctrl_kato_show()) without synchronization or READ_ONCE() cause a
data race [1] when administrative commands or state transitions
concurrently update the controller state, resulting in inconsistent or
torn debugfs output?
[1] https://sashiko.dev/#/bug/linux-2b037cd9-c44c-44de-95f8-41de5f514a0b
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261115012806699yIujDZo6TywlxuhhSIktO@zte.com.cn?part=1
prev parent reply other threads:[~2026-11-14 17:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 17:28 [PATCH] nvmet: fix the CSTS state iteration in debugfs shao.mingyin
2026-11-14 17:32 ` sashiko-bot [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=sashiko-outbox-214841@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shao.mingyin@zte.com.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.