nvmf: always zero admin ctrlr-to-host data buffers
For admin commands with controller to host transfers, make sure no uninitialized data is returned to the host. This allows us to remove a few other memset()s in per-command handlers. Change-Id: I00ef42945a118b6e7a0b68ab21c59fdcd21d0ee2 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/376024 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
47182bd7c9
commit
afb3f73869
@ -799,8 +799,6 @@ spdk_nvmf_ctrlr_get_log_page(struct spdk_nvmf_request *req)
|
||||
return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
|
||||
}
|
||||
|
||||
memset(req->data, 0, req->length);
|
||||
|
||||
offset = (uint64_t)cmd->cdw12 | ((uint64_t)cmd->cdw13 << 32);
|
||||
if (offset & 3) {
|
||||
SPDK_ERRLOG("Invalid log page offset 0x%" PRIx64 "\n", offset);
|
||||
@ -980,10 +978,6 @@ spdk_nvmf_ctrlr_identify(struct spdk_nvmf_request *req)
|
||||
struct spdk_nvme_cpl *rsp = &req->rsp->nvme_cpl;
|
||||
struct spdk_nvmf_subsystem *subsystem = ctrlr->subsys;
|
||||
|
||||
if (req->data) {
|
||||
memset(req->data, 0, req->length);
|
||||
}
|
||||
|
||||
if (req->data == NULL || req->length < 4096) {
|
||||
SPDK_ERRLOG("identify command with invalid buffer\n");
|
||||
rsp->status.sct = SPDK_NVME_SCT_GENERIC;
|
||||
@ -1136,6 +1130,10 @@ spdk_nvmf_ctrlr_process_admin_cmd(struct spdk_nvmf_request *req)
|
||||
struct spdk_nvme_cmd *cmd = &req->cmd->nvme_cmd;
|
||||
struct spdk_nvme_cpl *response = &req->rsp->nvme_cpl;
|
||||
|
||||
if (req->data && spdk_nvme_opc_get_data_transfer(cmd->opc) == SPDK_NVME_DATA_CONTROLLER_TO_HOST) {
|
||||
memset(req->data, 0, req->length);
|
||||
}
|
||||
|
||||
if (subsystem->subtype == SPDK_NVMF_SUBTYPE_DISCOVERY) {
|
||||
/* Discovery controllers only support Get Log Page and Identify */
|
||||
switch (cmd->opc) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user