diff options
author | Klaus Jensen | 2021-03-22 06:58:38 +0100 |
---|---|---|
committer | Klaus Jensen | 2021-03-29 18:46:47 +0200 |
commit | 9561353ddc35215141adf181d4d8f6f0d9655cc0 (patch) | |
tree | f5ca6326806fede47b3d283e87983d17bc0557f6 /hw/block/nvme-dif.c | |
parent | Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-6.0-pull-re... (diff) | |
download | qemu-9561353ddc35215141adf181d4d8f6f0d9655cc0.tar.gz qemu-9561353ddc35215141adf181d4d8f6f0d9655cc0.tar.xz qemu-9561353ddc35215141adf181d4d8f6f0d9655cc0.zip |
hw/block/nvme: fix resource leak in nvme_dif_rw
If nvme_map_dptr() fails, nvme_dif_rw() will leak the bounce context.
Fix this by using the same error handling as everywhere else in the
function.
Reported-by: Coverity (CID 1451080)
Fixes: 146f720c5563 ("hw/block/nvme: end-to-end data protection")
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Diffstat (limited to 'hw/block/nvme-dif.c')
-rw-r--r-- | hw/block/nvme-dif.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/block/nvme-dif.c b/hw/block/nvme-dif.c index 2038d724bd..e6f04faafb 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); |