]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
interface: fix udev backend use after free
authorDoug Goldstein <cardoe@cardoe.com>
Mon, 18 Feb 2013 04:26:38 +0000 (22:26 -0600)
committerDoug Goldstein <cardoe@cardoe.com>
Mon, 18 Feb 2013 14:59:23 +0000 (08:59 -0600)
udevIfaceListAllInterface() used the udev_device after it had its ref
count decremented which results in a use after free issue.

src/interface/interface_backend_udev.c

index 92c35d9202f7119c9abd1327e03a1d2c706a94a0..2c41bde8144d4f4dae37a6e6a0b6e466aa8e1658 100644 (file)
@@ -359,7 +359,6 @@ udevIfaceListAllInterfaces(virConnectPtr conn,
         name = udev_device_get_sysname(dev);
         macaddr = udev_device_get_sysattr_value(dev, "address");
         status = STREQ(udev_device_get_sysattr_value(dev, "operstate"), "up");
-        udev_device_unref(dev);
 
         /* Filter the results */
         if (status && (flags & VIR_CONNECT_LIST_INTERFACES_ACTIVE))
@@ -375,6 +374,7 @@ udevIfaceListAllInterfaces(virConnectPtr conn,
             }
             count++;
         }
+        udev_device_unref(dev);
     }
 
     /* Drop our refcounts */