wifi: improve fix to avoid device double release on disable
authorGrant Erickson <marathon96@gmail.com>
Fri, 12 Apr 2013 19:06:06 +0000 (12:06 -0700)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 15 Apr 2013 06:16:41 +0000 (09:16 +0300)
commitd1e576cfbe3d7458e984264ba2efc3f17088a0ce
treecf951c8edca6158999519ad3443a7611f32a3b2b
parenta9157ebb583ae6f9612df4418eea3a80f422b980
wifi: improve fix to avoid device double release on disable

Per MEEGO-25999 <https://bugs.meego.com/show_bug.cgi?id=25999>, there
exists a race between scan_callback and wifi_disable such that a care-
fully-timed deassertion of the technology Powered property between
throw_wifi_scan and scan_callback will lead to a device reference
count underflow. A second Powered property false -> true -> false
transition will then deallocate the device and Wi-Fi will no longer
function until connman or the system is restarted.

This patch improves upon and revises the prior patch to address this
issue by recognizing that hidden networks involve a slightly different
code path and timing and that both this and the prior case can be
addressed by tracking the device scanning state and only releasing the
device when the state is asserted.
plugins/wifi.c