public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Oliver Neukum <oliver@neukum.org>
Cc: linux-bluetooth@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [patch]race condition in btusb disconnect() handling
Date: Tue, 19 Aug 2008 17:27:23 +0200	[thread overview]
Message-ID: <1219159643.7591.161.camel@violet.holtmann.net> (raw)
In-Reply-To: <200808191714.50309.oliver@neukum.org>

Hi Oliver,

> > > > > First you release the interface, then you unregister the hci.
> > > > 
> > > > Putting it after hci_unregister_dev is an issue. The unregister will
> > > > call __hci_dev_put and then in return will call the destruct callback
> > > > which will free the data pointer.
> > > > 
> > > > So either we use hci_dev_hold or make sure that disconnect can only
> > > > disable the SCO interface. That comes directly with the first comment
> > > > from you.
> > > 
> > > Here is a new version. I am afraid normal hci_dev_hold would fail if
> > > the disconnect happens because the btusb module is being unloaded.
> > 
> > the btusb_stop_traffic change is bogus. You don't need that. The flush
> > callback will be called to ensure that all TX traffic is released.
> 
> OK.
> 
> > I am not sure about hci_dev_hold. We ensure that a reference count to
> > the module is hold when the HCI device is brought up.
> 
> But won't the module be marked as going away and make try_module_get()
> fail?

when calling "hciconfig hci0 up" then it is impossible to unload the
btusb module since we keep a module reference.

I am thinking that just __set_isoc_interface(..., 0) when disconnect
gets called for the isoc interface and the releasing the interface is
the more cleaner way. I have to think about this.

Regards

Marcel



  reply	other threads:[~2008-08-19 15:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-19 12:23 [patch]race condition in btusb disconnect() handling Oliver Neukum
2008-08-19 12:43 ` Marcel Holtmann
2008-08-19 13:09   ` Oliver Neukum
2008-08-19 13:28     ` Marcel Holtmann
2008-08-19 13:40       ` Oliver Neukum
2008-08-19 14:05       ` Oliver Neukum
2008-08-19 14:31         ` Marcel Holtmann
2008-08-19 15:14           ` Oliver Neukum
2008-08-19 15:27             ` Marcel Holtmann [this message]
2008-08-19 15:34               ` Oliver Neukum

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=1219159643.7591.161.camel@violet.holtmann.net \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oliver@neukum.org \
    /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