From: Keith Busch <kbusch@kernel.org>
To: Chao Shi <coshi036@gmail.com>
Cc: linux-nvme@lists.infradead.org, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>, Jens Axboe <axboe@kernel.dk>,
Tatsuya Sasaki <tatsuya6.sasaki@kioxia.com>,
Maurizio Lombardi <mlombard@arkamax.eu>,
linux-kernel@vger.kernel.org, Sungwoo Kim <iam@sung-woo.kim>,
Dave Tian <daveti@purdue.edu>, Weidong Zhu <weizhu@fiu.edu>
Subject: Re: [PATCH v3] nvme: reject keep-alive passthrough on non-fabrics
Date: Fri, 22 May 2026 09:46:00 -0600 [thread overview]
Message-ID: <ahB6OCXQIYVvEW4m@kbusch-mbp> (raw)
In-Reply-To: <20260522152807.2061501-1-coshi036@gmail.com>
On Fri, May 22, 2026 at 11:28:07AM -0400, Chao Shi wrote:
> +static bool nvme_passthru_cmd_allowed(struct nvme_ctrl *ctrl,
> + struct nvme_command *c)
> +{
> + if (c->common.opcode != nvme_admin_set_features)
> + return true;
> +
> + switch (le32_to_cpu(c->common.cdw10) & 0xff) {
> + case NVME_FEAT_KATO:
> + /*
> + * Keep Alive is optional on PCIe (NVMe 2.0a 5.27.1.12) and the
> + * driver only arms keep-alive for fabrics. Enabling it on
> + * other transports starts a keep-alive command the driver is
> + * not set up for and harms idle power states, so reject it.
> + */
> + return ctrl->ops->flags & NVME_F_FABRICS;
> + default:
> + return true;
> + }
> +}
> +
> /*
> * Convert integer values from ioctl structures to user pointers, silently
> * ignoring the upper bits in the compat case to match behaviour of 32-bit
> @@ -311,6 +338,9 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
> if (!nvme_cmd_allowed(ns, &c, 0, open_for_write))
> return -EACCES;
>
> + if (!nvme_passthru_cmd_allowed(ctrl, &c))
> + return -EOPNOTSUPP;
You you have check if it's an admin command first. This going to break
the "Data Set Management" IO command.
next prev parent reply other threads:[~2026-05-22 15:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 15:28 [PATCH v3] nvme: reject keep-alive passthrough on non-fabrics Chao Shi
2026-05-22 15:46 ` Keith Busch [this message]
2026-05-22 16:27 ` Chao S
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=ahB6OCXQIYVvEW4m@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=axboe@kernel.dk \
--cc=coshi036@gmail.com \
--cc=daveti@purdue.edu \
--cc=hch@lst.de \
--cc=iam@sung-woo.kim \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=mlombard@arkamax.eu \
--cc=sagi@grimberg.me \
--cc=tatsuya6.sasaki@kioxia.com \
--cc=weizhu@fiu.edu \
/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