aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-03-29 18:45:12 +0100
committerPeter Maydell <peter.maydell@linaro.org>2021-03-29 18:45:12 +0100
commit7993b0f83fe5c3f8555e79781d5d098f99751a94 (patch)
tree2ea05b5ce90d74660e56869abb4f1548d04b981b
parentec2e6e016d24bd429792d08cf607e4c5350dcdaa (diff)
parent3a69cadbef7af23a566dbe2400043c247c3d50ca (diff)
downloadqemu-7993b0f83fe5c3f8555e79781d5d098f99751a94.zip
qemu-7993b0f83fe5c3f8555e79781d5d098f99751a94.tar.gz
qemu-7993b0f83fe5c3f8555e79781d5d098f99751a94.tar.bz2
Merge remote-tracking branch 'remotes/nvme/tags/nvme-fixes-for-6.0-pull-request' into staging
emulated nvme fixes # gpg: Signature made Mon 29 Mar 2021 18:03:30 BST # gpg: using RSA key 522833AA75E2DCE6A24766C04DE1AF316D4F0DE9 # gpg: Good signature from "Klaus Jensen <its@irrelevant.dk>" [unknown] # gpg: aka "Klaus Jensen <k.jensen@samsung.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: DDCA 4D9C 9EF9 31CC 3468 4272 63D5 6FC5 E55D A838 # Subkey fingerprint: 5228 33AA 75E2 DCE6 A247 66C0 4DE1 AF31 6D4F 0DE9 * remotes/nvme/tags/nvme-fixes-for-6.0-pull-request: hw/block/nvme: fix ref counting in nvme_format_ns hw/block/nvme: fix resource leak in nvme_dif_rw Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/block/nvme-dif.c2
-rw-r--r--hw/block/nvme.c10
2 files changed, 9 insertions, 3 deletions
diff --git a/hw/block/nvme-dif.c b/hw/block/nvme-dif.c
index 2038d72..e6f04fa 100644
--- a/hw/block/nvme-dif.c
+++ b/hw/block/nvme-dif.c
@@ -432,7 +432,7 @@ uint16_t nvme_dif_rw(NvmeCtrl *n, NvmeRequest *req)
status = nvme_map_dptr(n, &req->sg, mapped_len, &req->cmd);
if (status) {
- return status;
+ goto err;
}
ctx->data.bounce = g_malloc(len);
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 6842b01..c54ec3c 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -5009,9 +5009,15 @@ static uint16_t nvme_format_ns(NvmeCtrl *n, NvmeNamespace *ns, uint8_t lbaf,
}
- (*count)--;
+ if (--(*count)) {
+ return NVME_NO_COMPLETE;
+ }
- return NVME_NO_COMPLETE;
+ g_free(count);
+ ns->status = 0x0;
+ (*num_formats)--;
+
+ return NVME_SUCCESS;
}
static uint16_t nvme_format(NvmeCtrl *n, NvmeRequest *req)