mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-29 12:01:16 +00:00
interface: fix udev backend use after free
udevIfaceListAllInterface() used the udev_device after it had its ref count decremented which results in a use after free issue.
This commit is contained in:
parent
24cf110e48
commit
5eb621fcb3
@ -359,7 +359,6 @@ udevIfaceListAllInterfaces(virConnectPtr conn,
|
|||||||
name = udev_device_get_sysname(dev);
|
name = udev_device_get_sysname(dev);
|
||||||
macaddr = udev_device_get_sysattr_value(dev, "address");
|
macaddr = udev_device_get_sysattr_value(dev, "address");
|
||||||
status = STREQ(udev_device_get_sysattr_value(dev, "operstate"), "up");
|
status = STREQ(udev_device_get_sysattr_value(dev, "operstate"), "up");
|
||||||
udev_device_unref(dev);
|
|
||||||
|
|
||||||
/* Filter the results */
|
/* Filter the results */
|
||||||
if (status && (flags & VIR_CONNECT_LIST_INTERFACES_ACTIVE))
|
if (status && (flags & VIR_CONNECT_LIST_INTERFACES_ACTIVE))
|
||||||
@ -375,6 +374,7 @@ udevIfaceListAllInterfaces(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
udev_device_unref(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Drop our refcounts */
|
/* Drop our refcounts */
|
||||||
|
Loading…
Reference in New Issue
Block a user