From 0065f42ef1206527188a44e9c456c9b6d10de5ec Mon Sep 17 00:00:00 2001 From: Gollu Appalanaidu Date: Sun, 24 Jan 2021 21:05:32 +0530 Subject: [PATCH] hw/block/nvme: fix set feature save field check Currently, no features are saveable, so the current check is not wrong, but add a check against the feature capabilities to make sure this will not regress if saveable features are added later. Signed-off-by: Gollu Appalanaidu Reviewed-by: Klaus Jensen Reviewed-by: Keith Busch Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index b3d072c8b2..c99a3fbf34 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -3324,7 +3324,7 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeRequest *req) trace_pci_nvme_setfeat(nvme_cid(req), nsid, fid, save, dw11); - if (save) { + if (save && !(nvme_feature_cap[fid] & NVME_FEAT_CAP_SAVE)) { return NVME_FID_NOT_SAVEABLE | NVME_DNR; } -- 2.11.4.GIT