nvmf: add parameter check for Reservation Acquire command

Nvmecli tool doesn't add parameter check when submitting
to NVMf target, so we add additional check in NVMf target
to prevent such cases.

Change-Id: Ieb2b3b3c22d71913f2743a0f9cdad4aba184c320
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450574
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Changpeng Liu 2019-04-08 22:07:40 -04:00
parent 7c331adfeb
commit 58d923e6cc

View File

@ -1561,7 +1561,7 @@ nvmf_ns_reservation_acquire(struct spdk_nvmf_ns *ns,
"NRKEY 0x%"PRIx64", PRKEY 0x%"PRIx64"\n",
racqa, iekey, rtype, key.crkey, key.prkey);
if (iekey) {
if (iekey || rtype > SPDK_NVME_RESERVE_EXCLUSIVE_ACCESS_ALL_REGS) {
SPDK_ERRLOG("Ignore existing key field set to 1\n");
status = SPDK_NVME_SC_INVALID_FIELD;
update_sgroup = false;
@ -1641,6 +1641,7 @@ nvmf_ns_reservation_acquire(struct spdk_nvmf_ns *ns,
}
break;
default:
status = SPDK_NVME_SC_INVALID_FIELD;
update_sgroup = false;
break;
}