[libvirt] [PATCH] qemu_command: fix double_close vhostfd in qemuBuildHostdevCommandLine

Jie Wang posted 1 patch 4 years, 11 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1556601855-59450-1-git-send-email-wangjie88@huawei.com
src/qemu/qemu_command.c | 1 -
1 file changed, 1 deletion(-)
[libvirt] [PATCH] qemu_command: fix double_close vhostfd in qemuBuildHostdevCommandLine
Posted by Jie Wang 4 years, 11 months ago
vhostfd passed to cmd->passfd in virCommandPassFD, virCommandFree will
always close cmd->passfd when qemuBuildSCSIVHostHostdevDevStr failed.

Signed-off-by: Jie Wang <wangjie88@huawei.com>
---
 src/qemu/qemu_command.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 029780fe86..3fc2dfa2f1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5819,7 +5819,6 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
                                                                qemuCaps,
                                                                vhostfdName))) {
                     VIR_FREE(vhostfdName);
-                    VIR_FORCE_CLOSE(vhostfd);
                     return -1;
                 }
                 virCommandAddArg(cmd, devstr);
-- 
2.16.2.windows.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu_command: fix double_close vhostfd in qemuBuildHostdevCommandLine
Posted by Michal Privoznik 4 years, 11 months ago
On 4/30/19 7:24 AM, Jie Wang wrote:
> vhostfd passed to cmd->passfd in virCommandPassFD, virCommandFree will
> always close cmd->passfd when qemuBuildSCSIVHostHostdevDevStr failed.
> 
> Signed-off-by: Jie Wang <wangjie88@huawei.com>
> ---
>   src/qemu/qemu_command.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 029780fe86..3fc2dfa2f1 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -5819,7 +5819,6 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
>                                                                  qemuCaps,
>                                                                  vhostfdName))) {
>                       VIR_FREE(vhostfdName);
> -                    VIR_FORCE_CLOSE(vhostfd);
>                       return -1;
>                   }
>                   virCommandAddArg(cmd, devstr);
> 

ACKed and pushed. Nice catch. There are some more I found too, I'll post 
a patch later.

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list