diff options
author | Dmitry Tikhov | 2022-04-21 12:51:58 +0200 |
---|---|---|
committer | Klaus Jensen | 2022-06-03 21:48:24 +0200 |
commit | 2e8f952ae7de23b4847937dbbf51f7a1ab10a2af (patch) | |
tree | 1cd31ca7ba9f1b2db7b659df0c9d590e8c1e0a43 /hw/nvme | |
parent | hw/nvme: add missing return statement (diff) | |
download | qemu-2e8f952ae7de23b4847937dbbf51f7a1ab10a2af.tar.gz qemu-2e8f952ae7de23b4847937dbbf51f7a1ab10a2af.tar.xz qemu-2e8f952ae7de23b4847937dbbf51f7a1ab10a2af.zip |
hw/nvme: fix copy cmd for pi enabled namespaces
Current implementation have problem in the read part of copy command.
Because there is no metadata mangling before nvme_dif_check invocation,
reftag error could be thrown for blocks of namespace that have not been
previously written to.
Signed-off-by: Dmitry Tikhov <d.tihov@yadro.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Diffstat (limited to 'hw/nvme')
-rw-r--r-- | hw/nvme/ctrl.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 74540a03d5..08574c4dcb 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -2787,6 +2787,10 @@ static void nvme_copy_in_completed_cb(void *opaque, int ret) size_t mlen = nvme_m2b(ns, nlb); uint8_t *mbounce = iocb->bounce + nvme_l2b(ns, nlb); + status = nvme_dif_mangle_mdata(ns, mbounce, mlen, slba); + if (status) { + goto invalid; + } status = nvme_dif_check(ns, iocb->bounce, len, mbounce, mlen, prinfor, slba, apptag, appmask, &reftag); if (status) { |