summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2018-12-04 19:05:27 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2018-12-04 19:17:13 +0100
commit92e57ab2929ce0f63a4d026d0be0886847a1e479 (patch)
tree10ce2a2f8ea30136087603bc654b4f064b55d03d
parent6ba9f47c94df4a6ec8282238edca22c8d767a171 (diff)
core: avoid assertion when removing devicesHEADmaster
remove_device() is also called when the device has no longer a valid ifindex and so device_is_wake_on_lan() must do an extra check to avoid the following assertion: nmp_cache_lookup_entry_link: assertion 'ifindex > 0' failed 0 _g_log_abort () from target:/lib64/libglib-2.0.so.0 1 g_logv () from target:/lib64/libglib-2.0.so.0 2 g_log () from target:/lib64/libglib-2.0.so.0 3 nmp_cache_lookup_entry_link (cache=0xb858f0, ifindex=ifindex@entry=0) at ../src/platform/nmp-object.c:1713 4 nmp_cache_lookup_link (cache=<optimized out>, ifindex=ifindex@entry=0) at ../src/platform/nmp-object.c:1728 5 nm_platform_link_get_obj (self=self@entry=0xb85840, ifindex=ifindex@entry=0, visible_only=visible_only@entry=1) at ../src/platform/nm-platform.c:759 6 nm_platform_link_get (self=self@entry=0xb85840, ifindex=ifindex@entry=0) at ../src/platform/nm-platform.c:784 7 nm_platform_link_get_type (self=self@entry=0xb85840, ifindex=ifindex@entry=0) at ../src/platform/nm-platform.c:1065 8 link_get_wake_on_lan (platform=0xb85840, ifindex=0) at ../src/platform/nm-linux-platform.c:6963 9 nm_platform_link_get_wake_on_lan (self=self@entry=0xb85840, ifindex=0) at ../src/platform/nm-platform.c:1705 10 device_is_wake_on_lan (platform=0xb85840, device=<optimized out>) at ../src/nm-manager.c:1617 11 remove_device (self=0xbd0060, device=<optimized out>, device@entry=0xd298c0, quitting=quitting@entry=0, allow_unmanage=allow_unmanage@entry=1) 12 device_removed_cb (device=0xd298c0, user_data=0xbd0060) at ../src/nm-manager.c:1698 13 _g_closure_invoke_va () from target:/lib64/libgobject-2.0.so.0 14 g_signal_emit_valist () from target:/lib64/libgobject-2.0.so.0 15 g_signal_emit () from target:/lib64/libgobject-2.0.so.0 16 available_connections_check_delete_unrealized_on_idle (user_data=0xd298c0) at ../src/devices/nm-device.c:4446 Fixes: ca3bbede746a7d7031ba6a011c69ad7adb1dca3e
-rw-r--r--src/nm-manager.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 7914d16d1..9200b24fd 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -1614,7 +1614,12 @@ again:
static gboolean
device_is_wake_on_lan (NMPlatform *platform, NMDevice *device)
{
- return nm_platform_link_get_wake_on_lan (platform, nm_device_get_ip_ifindex (device));
+ int ifindex;
+
+ ifindex = nm_device_get_ip_ifindex (device);
+ if (ifindex <= 0)
+ return FALSE;
+ return nm_platform_link_get_wake_on_lan (platform, ifindex);
}
static void