* [Bluez-devel] race condition in hci_usb.c?
@ 2006-09-22 18:08 Jose Vasconcellos
2006-09-25 21:40 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Jose Vasconcellos @ 2006-09-22 18:08 UTC (permalink / raw)
To: bluez-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Bluez-devel] race condition in hci_usb.c?
2006-09-22 18:08 [Bluez-devel] race condition in hci_usb.c? Jose Vasconcellos
@ 2006-09-25 21:40 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2006-09-25 21:40 UTC (permalink / raw)
To: BlueZ development
Hi Jose,
> 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.
feel free to provide a patch. In general the hci_usb driver needs a
complete rewrite anyway.
Regards
Marcel
-------------------------------------------------------------------------
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-09-25 21:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-22 18:08 [Bluez-devel] race condition in hci_usb.c? Jose Vasconcellos
2006-09-25 21:40 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox