* [PATCH for 5.15.y] nvme: fix miss command type check
@ 2024-04-07 9:15 Tokunori Ikegami
2024-04-08 11:32 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: Tokunori Ikegami @ 2024-04-07 9:15 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-nvme, stable, min15.li, Kanchan Joshi, Christoph Hellwig,
Keith Busch, Tokunori Ikegami
From: "min15.li" <min15.li@samsung.com>
commit 31a5978243d24d77be4bacca56c78a0fbc43b00d upstream.
In the function nvme_passthru_end(), only the value of the command
opcode is checked, without checking the command type (IO command or
Admin command). When we send a Dataset Management command (The opcode
of the Dataset Management command is the same as the Set Feature
command), kernel thinks it is a set feature command, then sets the
controller's keep alive interval, and calls nvme_keep_alive_work().
Signed-off-by: min15.li <min15.li@samsung.com>
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Fixes: b58da2d270db ("nvme: update keep alive interval when kato is modified")
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
---
drivers/nvme/host/core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 8f06e5c1706b..960a31e3307a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1185,7 +1185,7 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
return effects;
}
-static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects,
+static void nvme_passthru_end(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u32 effects,
struct nvme_command *cmd, int status)
{
if (effects & NVME_CMD_EFFECTS_CSE_MASK) {
@@ -1201,6 +1201,8 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects,
nvme_queue_scan(ctrl);
flush_work(&ctrl->scan_work);
}
+ if (ns)
+ return;
switch (cmd->common.opcode) {
case nvme_admin_set_features:
@@ -1235,7 +1237,7 @@ int nvme_execute_passthru_rq(struct request *rq)
effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode);
ret = nvme_execute_rq(disk, rq, false);
if (effects) /* nothing to be done for zero cmd effects */
- nvme_passthru_end(ctrl, effects, cmd, ret);
+ nvme_passthru_end(ctrl, ns, effects, cmd, ret);
return ret;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH for 5.15.y] nvme: fix miss command type check
2024-04-07 9:15 [PATCH for 5.15.y] nvme: fix miss command type check Tokunori Ikegami
@ 2024-04-08 11:32 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2024-04-08 11:32 UTC (permalink / raw)
To: Tokunori Ikegami
Cc: linux-nvme, stable, min15.li, Kanchan Joshi, Christoph Hellwig,
Keith Busch
On Sun, Apr 07, 2024 at 06:15:28PM +0900, Tokunori Ikegami wrote:
> From: "min15.li" <min15.li@samsung.com>
>
> commit 31a5978243d24d77be4bacca56c78a0fbc43b00d upstream.
>
> In the function nvme_passthru_end(), only the value of the command
> opcode is checked, without checking the command type (IO command or
> Admin command). When we send a Dataset Management command (The opcode
> of the Dataset Management command is the same as the Set Feature
> command), kernel thinks it is a set feature command, then sets the
> controller's keep alive interval, and calls nvme_keep_alive_work().
>
> Signed-off-by: min15.li <min15.li@samsung.com>
> Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> Fixes: b58da2d270db ("nvme: update keep alive interval when kato is modified")
> Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
> ---
> drivers/nvme/host/core.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Both now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-08 11:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-07 9:15 [PATCH for 5.15.y] nvme: fix miss command type check Tokunori Ikegami
2024-04-08 11:32 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox