hw/nvme: add missing return statement
PATCH v2 1/1 hw/nvme: add missing return statement
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.
---
v2:
- Instead of adding else just insert return statement
- Add: "Fixes: d7d1474fd85d" to commit message
hw/nvme/ctrl.c | 1 + 1 file changed, 1 insertion(+)
hw/nvme/ctrl.c +1 -0
@@ -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),
Signature · 1 line
2.35.1
Klaus Jensen
AppliedQuoted 32 lines · Dmitry Tikhov
Since there is no return after
nvme_dsm_cbinvocation, metadata associated with non-zero block range is currently zeroed. Also this behaviour leads to segfault since we scheduleiocb->bhtwo times. First when enteringnvme_dsm_cbwithiocb->idx==iocb->nrand second because of missing return on call stack unwinding by callingblk_aio_pwrite_zeroesand subsequentnvme_dsm_cbcallback.Fixes d7d1474fd85d ("hw/nvme: reimplement dsm to allow cancellation")Signed-off-by Dmitry Tikhov <[email protected]>---
v2:
- Instead of adding else just insert return statement
- Add: "Fixes:d7d1474fd85d" to commit messagehw/nvme/ctrl.c | 1 + 1 file changed, 1 insertion(+)hw/nvme/ctrl.c +1
-0@@ -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),Signature · 1 line
2.35.1
Thanks,
Applied to nvme-next!