wifi: avoid device double release on disable
authorGrant Erickson <marathon96@gmail.com>
Thu, 11 Apr 2013 07:28:11 +0000 (00:28 -0700)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 11 Apr 2013 23:15:55 +0000 (07:15 +0800)
commit74798430e79654c8ee1391f4ac5b21faca56e0a4
tree00d7c98ead5221ec10d91d5f3f4dbd2ce2fe4047
parentc2ed55115bb97ffd4770f2d49667c515f39b34e7
wifi: 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 addresses that race by tracking and observing the disabling
state such that scan_callback ad wifi_disable can effectively negotiate
which has performed the device release, thereby avoiding the double
release and resulting underflow.
plugins/wifi.c