emulated nvme fixes

-----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmBiCGIACgkQTeGvMW1P
 DelF4ggAqg1fMknSqY8xKuNIvtgE7yfL8uSsp98WR70Dlc9Ri2SwuAi6pe0t6U1l
 khCE8qcHQxhPeaCvTtHfmiUvPPWmpBr9pjOTB6Kiq8WIcZ6Y2h2qxO9VKFPI01/V
 FY7Wn6u4HR9hhn60g7vN26tB3bQOj96rfuOKJjB+jmJ5z3e26cBiZsIxHsR8SWpP
 NOZLW96H19quq1yy8QM0N02vx8n9IAVr+txTe7KtxErcAuhzvbBCR2aYedqxtt11
 eEXlU5YBLZRbnxLkXuaoUBcXyPv5r/N3IAhWgvFlCmPKhlUXCuVE97SCG0xglom8
 hqeYYKvOOPYpj5fJfQ6eGzpc61tU0g==
 =efGd
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Peter Maydell 2021-03-29 18:45:12 +01:00
commit 7993b0f83f
2 changed files with 9 additions and 3 deletions

View file

@ -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);

View file

@ -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)