aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2018-12-07 10:40:13 -0500
committerJens Axboe <axboe@kernel.dk>2018-12-07 10:40:13 -0500
commit8b878ee247ef2691bd69e1bc3df5ae93738ea028 (patch)
treec3a037f0dfbaedc5da564b9ab74d5a3d572948d0
parentc616cbee97aed4bc6178f148a7240206dcdb85a6 (diff)
parentd7dcdf9d4e15189ecfda24cc87339a3425448d5c (diff)
Merge branch 'nvme-4.20' of git://git.infradead.org/nvme into for-linus
Pull NVMe fixes from Christoph. * 'nvme-4.20' of git://git.infradead.org/nvme: nvmet-rdma: fix response use after free nvme: validate controller state before rescheduling keep alive
-rw-r--r--drivers/nvme/host/core.c10
-rw-r--r--drivers/nvme/target/rdma.c3
2 files changed, 11 insertions, 2 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 3cf1b773158e..962012135b62 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -831,6 +831,8 @@ static int nvme_submit_user_cmd(struct request_queue *q,
831static void nvme_keep_alive_end_io(struct request *rq, blk_status_t status) 831static void nvme_keep_alive_end_io(struct request *rq, blk_status_t status)
832{ 832{
833 struct nvme_ctrl *ctrl = rq->end_io_data; 833 struct nvme_ctrl *ctrl = rq->end_io_data;
834 unsigned long flags;
835 bool startka = false;
834 836
835 blk_mq_free_request(rq); 837 blk_mq_free_request(rq);
836 838
@@ -841,7 +843,13 @@ static void nvme_keep_alive_end_io(struct request *rq, blk_status_t status)
841 return; 843 return;
842 } 844 }
843 845
844 schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ); 846 spin_lock_irqsave(&ctrl->lock, flags);
847 if (ctrl->state == NVME_CTRL_LIVE ||
848 ctrl->state == NVME_CTRL_CONNECTING)
849 startka = true;
850 spin_unlock_irqrestore(&ctrl->lock, flags);
851 if (startka)
852 schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);
845} 853}
846 854
847static int nvme_keep_alive(struct nvme_ctrl *ctrl) 855static int nvme_keep_alive(struct nvme_ctrl *ctrl)
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 3f7971d3706d..583086dd9cb9 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -529,6 +529,7 @@ static void nvmet_rdma_send_done(struct ib_cq *cq, struct ib_wc *wc)
529{ 529{
530 struct nvmet_rdma_rsp *rsp = 530 struct nvmet_rdma_rsp *rsp =
531 container_of(wc->wr_cqe, struct nvmet_rdma_rsp, send_cqe); 531 container_of(wc->wr_cqe, struct nvmet_rdma_rsp, send_cqe);
532 struct nvmet_rdma_queue *queue = cq->cq_context;
532 533
533 nvmet_rdma_release_rsp(rsp); 534 nvmet_rdma_release_rsp(rsp);
534 535
@@ -536,7 +537,7 @@ static void nvmet_rdma_send_done(struct ib_cq *cq, struct ib_wc *wc)
536 wc->status != IB_WC_WR_FLUSH_ERR)) { 537 wc->status != IB_WC_WR_FLUSH_ERR)) {
537 pr_err("SEND for CQE 0x%p failed with status %s (%d).\n", 538 pr_err("SEND for CQE 0x%p failed with status %s (%d).\n",
538 wc->wr_cqe, ib_wc_status_msg(wc->status), wc->status); 539 wc->wr_cqe, ib_wc_status_msg(wc->status), wc->status);
539 nvmet_rdma_error_comp(rsp->queue); 540 nvmet_rdma_error_comp(queue);
540 } 541 }
541} 542}
542 543