aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nvme/host/nvme.h
diff options
context:
space:
mode:
authorRoland Dreier <roland@purestorage.com>2018-01-11 13:38:15 -0800
committerSagi Grimberg <sagi@grimberg.me>2018-02-12 22:18:14 +0200
commit0a34e4668c508cbbc2d5ef2d9710b145e4c0b27d (patch)
tree53697e55ea1cfe7236ccac678c0a2ac6b103a9d9 /drivers/nvme/host/nvme.h
parentnvme_fc: cleanup io completion (diff)
downloadlinux-dev-0a34e4668c508cbbc2d5ef2d9710b145e4c0b27d.tar.xz
linux-dev-0a34e4668c508cbbc2d5ef2d9710b145e4c0b27d.zip
nvme: Don't use a stack buffer for keep-alive command
In nvme_keep_alive() we pass a request with a pointer to an NVMe command on the stack into blk_execute_rq_nowait(). However, the block layer doesn't guarantee that the request is fully queued before blk_execute_rq_nowait() returns. If not, and the request is queued after nvme_keep_alive() returns, then we'll end up using stack memory that might have been overwritten to form the NVMe command we pass to hardware. Fix this by keeping a special command struct in the nvme_ctrl struct right next to the delayed work struct used for keep-alives. Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Diffstat (limited to 'drivers/nvme/host/nvme.h')
-rw-r--r--drivers/nvme/host/nvme.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 27e31c00b306..0521e4707d1c 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -183,6 +183,7 @@ struct nvme_ctrl {
struct work_struct scan_work;
struct work_struct async_event_work;
struct delayed_work ka_work;
+ struct nvme_command ka_cmd;
struct work_struct fw_act_work;
/* Power saving configuration */