summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2013-08-21 12:36:14 +0200
committerThomas Haller <thaller@redhat.com>2013-08-22 20:40:53 +0200
commit34d28376ed0979f547249a59c2e9b1e47e0eaa97 (patch)
tree2fad53b87850a8d5b4019aca5a7c47fcaee4b74c
parentbfce3f7dc8859eef5ba46f3eec463bd591ee8686 (diff)
core: fix segfault on initialization of macvlan and gre device
The link_changed method expects a valid info parameter. NMDeviceMacvlan and NMDeviceGre calls link_changed during construction for initialization. As it was before, NMDeviceMacvlan and NMDeviceGre passed NULL as NMPlatformLink, causing NM to segfault. (Regression was introduced in 0e361e894c4c3b699e89c68ccc7fee6b4adb09f9) https://bugzilla.redhat.com/show_bug.cgi?id=997396 Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r--src/devices/nm-device-gre.c13
-rw-r--r--src/devices/nm-device-macvlan.c13
2 files changed, 18 insertions, 8 deletions
diff --git a/src/devices/nm-device-gre.c b/src/devices/nm-device-gre.c
index c816c94bc9..3e5fdd1bea 100644
--- a/src/devices/nm-device-gre.c
+++ b/src/devices/nm-device-gre.c
@@ -59,14 +59,12 @@ enum {
/**************************************************************/
static void
-link_changed (NMDevice *device, NMPlatformLink *info)
+update_properties (NMDevice *device)
{
NMDeviceGrePrivate *priv = NM_DEVICE_GRE_GET_PRIVATE (device);
GObject *object = G_OBJECT (device);
NMPlatformGreProperties props;
- NM_DEVICE_CLASS (nm_device_gre_parent_class)->link_changed (device, info);
-
if (!nm_platform_gre_get_properties (nm_device_get_ifindex (device), &props)) {
nm_log_warn (LOGD_HW, "(%s): could not read gre properties",
nm_device_get_iface (device));
@@ -108,6 +106,13 @@ link_changed (NMDevice *device, NMPlatformLink *info)
g_object_thaw_notify (object);
}
+static void
+link_changed (NMDevice *device, NMPlatformLink *info)
+{
+ NM_DEVICE_CLASS (nm_device_gre_parent_class)->link_changed (device, info);
+ update_properties (device);
+}
+
/**************************************************************/
NMDevice *
@@ -130,7 +135,7 @@ nm_device_gre_init (NMDeviceGre *self)
static void
constructed (GObject *object)
{
- link_changed (NM_DEVICE (object), NULL);
+ update_properties (NM_DEVICE (object));
G_OBJECT_CLASS (nm_device_gre_parent_class)->constructed (object);
}
diff --git a/src/devices/nm-device-macvlan.c b/src/devices/nm-device-macvlan.c
index 0f782024b4..fa71c35583 100644
--- a/src/devices/nm-device-macvlan.c
+++ b/src/devices/nm-device-macvlan.c
@@ -54,14 +54,12 @@ enum {
/**************************************************************/
static void
-link_changed (NMDevice *device, NMPlatformLink *info)
+update_properties (NMDevice *device)
{
NMDeviceMacvlanPrivate *priv = NM_DEVICE_MACVLAN_GET_PRIVATE (device);
GObject *object = G_OBJECT (device);
NMPlatformMacvlanProperties props;
- NM_DEVICE_CLASS (nm_device_macvlan_parent_class)->link_changed (device, info);
-
if (!nm_platform_macvlan_get_properties (nm_device_get_ifindex (device), &props)) {
nm_log_warn (LOGD_HW, "(%s): could not read macvlan properties",
nm_device_get_iface (device));
@@ -88,6 +86,13 @@ link_changed (NMDevice *device, NMPlatformLink *info)
g_object_thaw_notify (object);
}
+static void
+link_changed (NMDevice *device, NMPlatformLink *info)
+{
+ NM_DEVICE_CLASS (nm_device_macvlan_parent_class)->link_changed (device, info);
+ update_properties (device);
+}
+
/**************************************************************/
NMDevice *
@@ -110,7 +115,7 @@ nm_device_macvlan_init (NMDeviceMacvlan *self)
static void
constructed (GObject *object)
{
- link_changed (NM_DEVICE (object), NULL);
+ update_properties (NM_DEVICE (object));
G_OBJECT_CLASS (nm_device_macvlan_parent_class)->constructed (object);
}