From 2ec88c4f8c3912a07ea3bc686dcb5177b873ac59 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Wed, 21 Oct 2020 12:56:23 -0700 Subject: [PATCH] nvmf: Don't fail a property set command with invalid bits If the initiator sends a property set command to a valid register, but the value contains bits that are reserved by the NVMe specification, don't fail the whole command. Just log an error message. Previously, any valid bits set would take effect but then the command would also fail. That confuses the initiator and thinks it must retry the full property set. Signed-off-by: Ben Walker Change-Id: I566bc68c4469b9f41c69902e276f825c86683075 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4814 Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Reviewed-by: Jim Harris Reviewed-by: John Kariuki Reviewed-by: Aleksey Marchuk --- lib/nvmf/ctrlr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/nvmf/ctrlr.c b/lib/nvmf/ctrlr.c index 25c05063a..c0b691aea 100644 --- a/lib/nvmf/ctrlr.c +++ b/lib/nvmf/ctrlr.c @@ -950,8 +950,10 @@ nvmf_prop_set_cc(struct spdk_nvmf_ctrlr *ctrlr, uint32_t value) } if (diff.raw != 0) { + /* Print an error message, but don't fail the command in this case. + * If we did want to fail in this case, we'd need to ensure we acted + * on no other bits or the initiator gets confused. */ SPDK_ERRLOG("Prop Set CC toggled reserved bits 0x%x!\n", diff.raw); - return false; } return true;