On Thu, Mar 26, 2020 at 01:39:40PM +0100, Peter Krempa wrote:
No callers use it any more. Additionally if qemuBlockJobUpdate was
called with the last reference of the job e.g. in
qemuBlockJobRefreshJobs, the reading of the job state would happen from
freed memory.
Reported-by: Pavel Mores <pmores(a)redhat.com>
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_blockjob.c | 8 ++------
src/qemu/qemu_blockjob.h | 7 ++++---
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 21a043d369..6576f8721f 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -1658,10 +1658,8 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
*
* Update disk's mirror state in response to a block job event stored in
* blockJobStatus by qemuProcessHandleBlockJob event handler.
- *
- * Returns the block job event processed or -1 if there was no pending event.
*/
-int
+void
qemuBlockJobUpdate(virDomainObjPtr vm,
qemuBlockJobDataPtr job,
int asyncJob)
@@ -1669,14 +1667,12 @@ qemuBlockJobUpdate(virDomainObjPtr vm,
qemuDomainObjPrivatePtr priv = vm->privateData;
if (job->newstate == -1)
- return -1;
+ return;
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV))
qemuBlockJobEventProcess(priv->driver, vm, job, asyncJob);
else
qemuBlockJobEventProcessLegacy(priv->driver, vm, job, asyncJob);
-
- return job->state;
}
diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h
index 9264c70217..19498b5bd8 100644
--- a/src/qemu/qemu_blockjob.h
+++ b/src/qemu/qemu_blockjob.h
@@ -232,9 +232,10 @@ int
qemuBlockJobRefreshJobs(virQEMUDriverPtr driver,
virDomainObjPtr vm);
-int qemuBlockJobUpdate(virDomainObjPtr vm,
- qemuBlockJobDataPtr job,
- int asyncJob);
+void
+qemuBlockJobUpdate(virDomainObjPtr vm,
+ qemuBlockJobDataPtr job,
+ int asyncJob);
void qemuBlockJobSyncBegin(qemuBlockJobDataPtr job);
void qemuBlockJobSyncEnd(virDomainObjPtr vm,
--
2.24.1
Reviewed-by: Pavel Mores <pmores(a)redhat.com>