public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: "Valmantas Palikša" <walmis@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: Corruption in bluetoothd if started when adapter was rfkilled
Date: Tue, 20 Oct 2009 16:38:46 +0300	[thread overview]
Message-ID: <20091020133610.GA14042@jh-x301> (raw)
In-Reply-To: <1255696908.12027.15.camel@walmis-laptop>

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]

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

[-- Attachment #2: adapter-init.patch --]
[-- Type: text/x-diff, Size: 444 bytes --]

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)

  reply	other threads:[~2009-10-20 13:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-16 12:41 Corruption in bluetoothd if started when adapter was rfkilled Valmantas Palikša
2009-10-20 13:38 ` Johan Hedberg [this message]
2009-10-20 19:57   ` Luiz Augusto von Dentz
2009-10-20 20:14     ` Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091020133610.GA14042@jh-x301 \
    --to=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=walmis@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox