Skip to content

Commit 2b1d1e2

Browse files
min15.lismb49
authored andcommitted
nvme: fix miss command type check
BugLink: https://bugs.launchpad.net/bugs/2065435 commit 31a5978 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 <[email protected]> Reviewed-by: Kanchan Joshi <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Keith Busch <[email protected]> Fixes: b58da2d ("nvme: update keep alive interval when kato is modified") Signed-off-by: Tokunori Ikegami <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Manuel Diewald <[email protected]> Signed-off-by: Roxana Nicolescu <[email protected]>
1 parent 7841f03 commit 2b1d1e2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/nvme/host/core.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
11851185
return effects;
11861186
}
11871187

1188-
static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects,
1188+
static void nvme_passthru_end(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u32 effects,
11891189
struct nvme_command *cmd, int status)
11901190
{
11911191
if (effects & NVME_CMD_EFFECTS_CSE_MASK) {
@@ -1201,6 +1201,8 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects,
12011201
nvme_queue_scan(ctrl);
12021202
flush_work(&ctrl->scan_work);
12031203
}
1204+
if (ns)
1205+
return;
12041206

12051207
switch (cmd->common.opcode) {
12061208
case nvme_admin_set_features:
@@ -1235,7 +1237,7 @@ int nvme_execute_passthru_rq(struct request *rq)
12351237
effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode);
12361238
ret = nvme_execute_rq(disk, rq, false);
12371239
if (effects) /* nothing to be done for zero cmd effects */
1238-
nvme_passthru_end(ctrl, effects, cmd, ret);
1240+
nvme_passthru_end(ctrl, ns, effects, cmd, ret);
12391241

12401242
return ret;
12411243
}

0 commit comments

Comments
 (0)