hw/nvme: add missing return statement
authorDmitry Tikhov <d.tihov@yadro.com>
Fri, 15 Apr 2022 20:48:32 +0000 (23:48 +0300)
committerKlaus Jensen <k.jensen@samsung.com>
Fri, 3 Jun 2022 19:48:24 +0000 (21:48 +0200)
Since there is no return after nvme_dsm_cb invocation, metadata
associated with non-zero block range is currently zeroed. Also this
behaviour leads to segfault since we schedule iocb->bh two times.
First when entering nvme_dsm_cb with iocb->idx == iocb->nr and
second because of missing return on call stack unwinding by calling
blk_aio_pwrite_zeroes and subsequent nvme_dsm_cb callback.

Fixes: d7d1474fd85d ("hw/nvme: reimplement dsm to allow cancellation")
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>
hw/nvme/ctrl.c

index 03760ddeae8cda0ae4c260cc73f379840e6389cf..74540a03d5189f87dd7213b6e2ccbb893b87b1a1 100644 (file)
@@ -2372,6 +2372,7 @@ static void nvme_dsm_md_cb(void *opaque, int ret)
         }
 
         nvme_dsm_cb(iocb, 0);
+        return;
     }
 
     iocb->aiocb = blk_aio_pwrite_zeroes(ns->blkconf.blk, nvme_moff(ns, slba),