Commit df24560d authored by Jens Axboe's avatar Jens Axboe

Merge tag 'nvme-6.1-2022-11-10' of git://git.infradead.org/nvme into block-6.1

Pull NVMe fixes from Christoph:

"nvme fixes for Linux 6.1

 - quiet user passthrough command errors (Keith Busch)
 - fix memory leak in nvmet_subsys_attr_model_store_locked
 - fix a memory leak in nvmet-auth (Sagi Grimberg)"

* tag 'nvme-6.1-2022-11-10' of git://git.infradead.org/nvme:
  nvmet: fix a memory leak
  nvmet: fix memory leak in nvmet_subsys_attr_model_store_locked
  nvme: quiet user passthrough command errors
parents f829230d e65fdf53
...@@ -675,6 +675,7 @@ void nvme_init_request(struct request *req, struct nvme_command *cmd) ...@@ -675,6 +675,7 @@ void nvme_init_request(struct request *req, struct nvme_command *cmd)
if (req->mq_hctx->type == HCTX_TYPE_POLL) if (req->mq_hctx->type == HCTX_TYPE_POLL)
req->cmd_flags |= REQ_POLLED; req->cmd_flags |= REQ_POLLED;
nvme_clear_nvme_request(req); nvme_clear_nvme_request(req);
req->rq_flags |= RQF_QUIET;
memcpy(nvme_req(req)->cmd, cmd, sizeof(*cmd)); memcpy(nvme_req(req)->cmd, cmd, sizeof(*cmd));
} }
EXPORT_SYMBOL_GPL(nvme_init_request); EXPORT_SYMBOL_GPL(nvme_init_request);
...@@ -1037,7 +1038,6 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd, ...@@ -1037,7 +1038,6 @@ int __nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd,
goto out; goto out;
} }
req->rq_flags |= RQF_QUIET;
ret = nvme_execute_rq(req, at_head); ret = nvme_execute_rq(req, at_head);
if (result && ret >= 0) if (result && ret >= 0)
*result = nvme_req(req)->result; *result = nvme_req(req)->result;
...@@ -1227,7 +1227,6 @@ static void nvme_keep_alive_work(struct work_struct *work) ...@@ -1227,7 +1227,6 @@ static void nvme_keep_alive_work(struct work_struct *work)
rq->timeout = ctrl->kato * HZ; rq->timeout = ctrl->kato * HZ;
rq->end_io = nvme_keep_alive_end_io; rq->end_io = nvme_keep_alive_end_io;
rq->end_io_data = ctrl; rq->end_io_data = ctrl;
rq->rq_flags |= RQF_QUIET;
blk_execute_rq_nowait(rq, false); blk_execute_rq_nowait(rq, false);
} }
......
...@@ -1436,7 +1436,6 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req) ...@@ -1436,7 +1436,6 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req)
abort_req->end_io = abort_endio; abort_req->end_io = abort_endio;
abort_req->end_io_data = NULL; abort_req->end_io_data = NULL;
abort_req->rq_flags |= RQF_QUIET;
blk_execute_rq_nowait(abort_req, false); blk_execute_rq_nowait(abort_req, false);
/* /*
...@@ -2490,7 +2489,6 @@ static int nvme_delete_queue(struct nvme_queue *nvmeq, u8 opcode) ...@@ -2490,7 +2489,6 @@ static int nvme_delete_queue(struct nvme_queue *nvmeq, u8 opcode)
req->end_io_data = nvmeq; req->end_io_data = nvmeq;
init_completion(&nvmeq->delete_done); init_completion(&nvmeq->delete_done);
req->rq_flags |= RQF_QUIET;
blk_execute_rq_nowait(req, false); blk_execute_rq_nowait(req, false);
return 0; return 0;
} }
......
...@@ -1215,6 +1215,7 @@ static ssize_t nvmet_subsys_attr_model_store_locked(struct nvmet_subsys *subsys, ...@@ -1215,6 +1215,7 @@ static ssize_t nvmet_subsys_attr_model_store_locked(struct nvmet_subsys *subsys,
const char *page, size_t count) const char *page, size_t count)
{ {
int pos = 0, len; int pos = 0, len;
char *val;
if (subsys->subsys_discovered) { if (subsys->subsys_discovered) {
pr_err("Can't set model number. %s is already assigned\n", pr_err("Can't set model number. %s is already assigned\n",
...@@ -1237,9 +1238,11 @@ static ssize_t nvmet_subsys_attr_model_store_locked(struct nvmet_subsys *subsys, ...@@ -1237,9 +1238,11 @@ static ssize_t nvmet_subsys_attr_model_store_locked(struct nvmet_subsys *subsys,
return -EINVAL; return -EINVAL;
} }
subsys->model_number = kmemdup_nul(page, len, GFP_KERNEL); val = kmemdup_nul(page, len, GFP_KERNEL);
if (!subsys->model_number) if (!val)
return -ENOMEM; return -ENOMEM;
kfree(subsys->model_number);
subsys->model_number = val;
return count; return count;
} }
...@@ -1836,6 +1839,7 @@ static void nvmet_host_release(struct config_item *item) ...@@ -1836,6 +1839,7 @@ static void nvmet_host_release(struct config_item *item)
#ifdef CONFIG_NVME_TARGET_AUTH #ifdef CONFIG_NVME_TARGET_AUTH
kfree(host->dhchap_secret); kfree(host->dhchap_secret);
kfree(host->dhchap_ctrl_secret);
#endif #endif
kfree(host); kfree(host);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment