device: fix assertion on unmanaged_mask for slave devices
authorBeniamino Galvani <bgalvani@redhat.com>
Thu, 18 Feb 2016 12:43:37 +0000 (13:43 +0100)
committerBeniamino Galvani <bgalvani@redhat.com>
Thu, 18 Feb 2016 13:18:07 +0000 (14:18 +0100)
commit86f005ea4b646b21ad2cf8ffdb783e72bff76065
tree2d876c0e52e5d29adfd274867a8da2df0240397d
parentd48790cbec7d19b20a10e1627dd8ee1c996425b1
device: fix assertion on unmanaged_mask for slave devices

When executing these commands:

  ip link add br0 type bridge
  ip link set dev br0 up
  ip link add dummy1 type dummy
  ip link set dev dummy1 up
  ip addr add 1.1.1.1/24 dev br0
  brctl addif br0 dummy1
  sleep 1
  ip link del br0
  ip link del dummy1

the following assertion was failing:

  nm_device_master_release_one_slave: runtime check failed: (NM_FLAGS_HAS (slave_priv->unmanaged_mask, NM_UNMANAGED_IS_SLAVE))

  #0  g_logv()
  #1  g_log()
  #2  g_warn_message()
  #3  nm_device_master_release_one_slave()
  #4  nm_device_cleanup()
  #5  _set_state_full()
  #6  nm_device_state_changed()
  #7  nm_device_unrealize()
  #8  _platform_link_cb_idle()
  #9  g_main_context_dispatch()
  #10 g_main_context_dispatch()
  #11 g_main_context_iterate()
  #12 g_main_loop_run()
  #13 main()

Upon slave removal we unrealize the device, resetting the unmanaged
flags to NM_UNMANAGED_PLATFORM_INIT, then we clean up the device and
call nm_device_master_release_one_slave(), which asserts the presence
of NM_UNMANAGED_IS_SLAVE flag cleared just before.

Drop the check.

Fixes: 87a3df2e572ed47b5f76f6d1cad63ce622296e21
src/devices/nm-device.c