Re: Corruption in bluetoothd if started when adapter was rfkilled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, Oct 16, 2009, Valmantas Palikša wrote:
> Steps to reproduce:
> 1. rfkill block bluetooth
> 2. start bluetoothd
> 3. kill bluetoothd

I don't seem to have rfkill support (at least using that command) on my
laptop so I can't verify this fix, but could you try the attached patch
and see if it resolves the issue? The problem seems to be that in this use
case we never load/probe the adapter drivers but still call their remove
callbacks when the adapter initialization fails. This causes some drivers
to call btd_adapter_unref on adapter objects for which they do not own a
reference.

Johan
diff --git a/src/adapter.c b/src/adapter.c
index ab07ca7..d225b86 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2472,7 +2472,8 @@ void adapter_remove(struct btd_adapter *adapter)
 		device_remove(l->data, FALSE);
 	g_slist_free(adapter->devices);
 
-	unload_drivers(adapter);
+	if (adapter->initialized)
+		unload_drivers(adapter);
 
 	/* Return adapter to down state if it was not up on init */
 	if (adapter->up && !adapter->already_up)

[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux