public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Jose Vasconcellos <jvasco@verizon.net>
To: bluez-devel@lists.sourceforge.net
Subject: [Bluez-devel] race condition in hci_usb.c?
Date: Fri, 22 Sep 2006 14:08:42 -0400	[thread overview]
Message-ID: <451426AA.7080700@verizon.net> (raw)

Hello,

I'm studying the hci_usb driver and I found a possible race condition.
The routine hci_usb_tx_wakeup is called from hci_sub_send_frame
and from hci_usb_tx_complete to get some work done by calling
hci_usb_tx_process. It basically provides serial access to
hci_usb_tx_process by using a couble of bit variables:
HCI_USB_TX_PROCESS and HCI_USB_TX_WAKEPUP.

The problem is that if hci_usb_tx_wakeup is invoked again from a
different context while execution is just terminating hci_usb_tx_process
(right after the while loop), then hci_usb_tx_process will miss the
wakeup. This condition will correct itself when another call is made
to hci_usb_send_frame or another urb finishes transmission.

I experimented by replacing hci_usb_tx_wakeup with a tasklet
that schedules hci_usb_tx_process. This to me seems like a safer
approach.

Regards,

Jose

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

             reply	other threads:[~2006-09-22 18:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-22 18:08 Jose Vasconcellos [this message]
2006-09-25 21:40 ` [Bluez-devel] race condition in hci_usb.c? Marcel Holtmann

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=451426AA.7080700@verizon.net \
    --to=jvasco@verizon.net \
    --cc=bluez-devel@lists.sourceforge.net \
    /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