[libvirt] [PATCH] domain_nwfilter: Return early if net has no name in virDomainConfNWFilterTeardownImpl

Michal Privoznik posted 1 patch 5 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cb92e642bf71cf0ef3011ddf74a36ee6dc66bea3.1531139995.git.mprivozn@redhat.com
Test syntax-check passed
src/conf/domain_nwfilter.c | 3 +++
1 file changed, 3 insertions(+)
[libvirt] [PATCH] domain_nwfilter: Return early if net has no name in virDomainConfNWFilterTeardownImpl
Posted by Michal Privoznik 5 years, 9 months ago
This function is called from various clean up paths (e.g.
from qemuBuildInterfaceCommandLine). However, depending on the
stage the interface creation process failed at, net->ifname might
still be not filled in when control jumps to cleanup label. If
that is the case return early (avoiding useless error message
produced in virNWFilterBindingLookupByPortDev) as there is no
NWFilter to tear down anyway.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/conf/domain_nwfilter.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/conf/domain_nwfilter.c b/src/conf/domain_nwfilter.c
index 24b5f42ddd..f39c8a1f9b 100644
--- a/src/conf/domain_nwfilter.c
+++ b/src/conf/domain_nwfilter.c
@@ -133,6 +133,9 @@ virDomainConfNWFilterTeardownImpl(virConnectPtr conn,
 {
     virNWFilterBindingPtr binding;
 
+    if (!net->ifname)
+        return;
+
     binding = virNWFilterBindingLookupByPortDev(conn, net->ifname);
     if (!binding)
         return;
-- 
2.16.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] domain_nwfilter: Return early if net has no name in virDomainConfNWFilterTeardownImpl
Posted by Erik Skultety 5 years, 9 months ago
On Mon, Jul 09, 2018 at 02:40:04PM +0200, Michal Privoznik wrote:
> This function is called from various clean up paths (e.g.
> from qemuBuildInterfaceCommandLine). However, depending on the
> stage the interface creation process failed at, net->ifname might
> still be not filled in when control jumps to cleanup label. If
> that is the case return early (avoiding useless error message
> produced in virNWFilterBindingLookupByPortDev) as there is no
> NWFilter to tear down anyway.
>
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
Reviewed-by: Erik Skultety <eskultet@redhat.com>

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