From cc66b547cfcc7b7dcc45c4c47fccec2c483d225d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Wed, 13 Mar 2013 09:28:38 +0100 Subject: [PATCH] device: do not call nm_system_iface_set_up() with invalid index (rh #920145) in hw_take_down() usb 1-3: USB disconnect, device number 6 modem-manager[547]: (tty/ttyACM0): released by modem /sys/devices/pci0000:00/0000:00:1a.7/usb1/1-3 (tty/ttyACM0): released by modem /sys/devices/pci0000:00/0000:00:1a.7/usb1/1-3 (ttyACM0): device state change: disconnected -> unmanaged (reason 'removed') [30 10 36] (ttyACM0): cleaning up... (ttyACM0): taking down device. nm_system_iface_set_up: assertion `ifindex > 0' failed --- src/nm-device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/nm-device.c b/src/nm-device.c index ab0d13079..4b9b9737e 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -4339,7 +4339,10 @@ nm_device_hw_take_down (NMDevice *self, gboolean block) static void hw_take_down (NMDevice *device) { - nm_system_iface_set_up (nm_device_get_ip_ifindex (device), FALSE, NULL); + int ifindex = nm_device_get_ip_ifindex (device); + + if (ifindex > 0) + nm_system_iface_set_up (ifindex, FALSE, NULL); } static gboolean