[PATCH] qemu: Fix handling of passed FDs in remoteDispatchDomainFdAssociate

Ján Tomko jtomko at redhat.com
Tue Jan 10 14:04:15 UTC 2023


On a Tuesday in 2023, Peter Krempa wrote:
>To ensure same behaviour when remote driver is or is not used we must
>not steal the FDs and array holding them passed to qemuDomainFDAssociate
>but rather duplicate them. At the same time the remote driver must close
>and free them to prevent leak.
>
>Pointed out by Coverity as FD leak on error path:
>
> *** CID 404348:  Resource leaks  (RESOURCE_LEAK)
> /src/remote/remote_daemon_dispatch.c: 7484 in remoteDispatchDomainFdAssociate()
> 7478         rv = 0;
> 7479
> 7480      cleanup:
> 7481         if (rv < 0)
> 7482             virNetMessageSaveError(rerr);
> 7483         virObjectUnref(dom);
> >>>     CID 404348:  Resource leaks  (RESOURCE_LEAK)
> >>>     Variable "fds" going out of scope leaks the storage it points to.
> 7484         return rv;
>
>Fixes: abd9025c2fd
>Fixes: f762f87534e
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/qemu/qemu_driver.c              | 15 ++++++++++++---
> src/remote/remote_daemon_dispatch.c |  3 +++
> 2 files changed, 15 insertions(+), 3 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20230110/97ca62c1/attachment.sig>


More information about the libvir-list mailing list