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]: <info>  (tty/ttyACM0): released by modem /sys/devices/pci0000:00/0000:00:1a.7/usb1/1-3
<info>  (tty/ttyACM0): released by modem /sys/devices/pci0000:00/0000:00:1a.7/usb1/1-3
<info> (ttyACM0): device state change: disconnected -> unmanaged (reason 'removed') [30 10 36]
<info> (ttyACM0): cleaning up...
<info> (ttyACM0): taking down device.
nm_system_iface_set_up: assertion `ifindex > 0' failed
This commit is contained in:
Jiří Klimeš
2013-03-13 09:28:38 +01:00
parent 44bcc990f7
commit cc66b547cf

View File

@@ -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