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)
 -----BEGIN PGP SIGNATURE-----
 
 iQI/BAABCgApFiEEgdbnc3r/njty3Iq9D55TZVIEUYMFAmNsyxULHGhjaEBsc3Qu
 ZGUACgkQD55TZVIEUYMBJQ//TYcXZBz+lFatba1hAkZMr5d1ZCSQK+JToK5YyKWG
 vpp8DPDHRZZmBD0lAi7MTuH5ZwS3TmhQQ2dQ3Y+27zOdMCRJft2coz6BXVi/Phm2
 tIX3Q0P1DRYML+qr57Fr2woxqRTtE2yHKoMhp8NHECCSGOd/9LvqT1T5Nrpqa/fN
 CoQxqMrAMMWVxBAPviHAAtvNzVaF3zPpoRYe6t6Py5SU1VNnbrJnbPKFO/1RHn0r
 86jIV8iRN/CvUpJ4C43x8QvtDoU5hUTUbQs4Jt3treWJIl9DEk18jHmCzAu4FsVd
 8KsjmQVxMal7WDULfC+r4XtxZQ/Bg9VRGE60mclEef3E696xY45QQu322fzaa5sU
 IliF4mN3RrnF37PQ7Rw7MdZPSB6J3/PYgtxGmXp7KWAnYDtuC6TfH5vYaui0PzdM
 icuJ9L+jak4yaEAbCUTl6bJgeG725/kQ45LMwPs85WHAxZ3X55my9wpVY/Tk2+9s
 NPL5FZcAmwOsUQjqYbDZChNZQhiD/Q4K33565ofDQ6iRaPTC15lA2lrJbwpRw/Gv
 YikZ73HygDUgLuToYLTYhKLRY3VsTy/Z9lIRHbR05IWhKb6PkDvDsEb4URKKfpFb
 gfsJ8xYw9n7Y1kEfyCU/EVezqoftTVDLW8L9wifjtc4EpHA4ydN88S68H0b8rnJR
 5X0=
 =Cpi6
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Jens Axboe 2022-11-10 06:55:02 -07:00
commit df24560d05
3 changed files with 7 additions and 6 deletions

View File

@ -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,
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)
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);
} }

View File

@ -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)
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;
} }

View File

@ -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,
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)
#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);
} }