]> git.proxmox.com Git - mirror_qemu.git/commit
hw/nvme: fix aio cancel in dsm
authorKlaus Jensen <k.jensen@samsung.com>
Thu, 10 Nov 2022 06:59:50 +0000 (07:59 +0100)
committerKlaus Jensen <k.jensen@samsung.com>
Thu, 1 Dec 2022 07:45:00 +0000 (08:45 +0100)
commit818b9b8f5efb728793b9a2c124adab371d2c16e5
tree33d2a71b27b2259c113203d6a85099e7aa4eb350
parent36a251c3468f34a2486dd49836e397534a1bb189
hw/nvme: fix aio cancel in dsm

When the DSM operation is cancelled asynchronously, we set iocb->ret to
-ECANCELED. However, the callback function only checks the return value
of the completed aio, which may have completed succesfully prior to the
cancellation and thus the callback ends up continuing the dsm operation
instead of bailing out. Fix this.

Secondly, fix a potential use-after-free by removing the bottom half and
enqueuing the completion directly.

Fixes: d7d1474fd85d ("hw/nvme: reimplement dsm to allow cancellation")
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
hw/nvme/ctrl.c