All of lore.kernel.org
 help / color / mirror / Atom feed
* [Kernel-janitors] doubt in drivers/usb/class/audio.c
@ 2004-07-01 13:22 Anupam Kapoor
  0 siblings, 0 replies; only message in thread
From: Anupam Kapoor @ 2004-07-01 13:22 UTC (permalink / raw)
  To: kernel-janitors

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

hi, 

while checking the above file for proper usage of set_current_state, i
came accross the following fragment (at approx line 2670) in
drivers/usb/class/audio.c:usb_audio_open()

	__set_current_state(TASK_INTERRUPTIBLE);
        add_wait_queue(&open_wait, &wait);

the problem here (imho) is that, it is possible that the
current->state write is re-ordered after the process was added to the
wait queue. if the task gets woken up in between those events, then we
have a problem.

so what actually happens is

add_wait_queue(&open_wait, &wait);
<the task get's woken up here>
__set_current_state(TASK_INTERRUPTIBLE);

now we are in a big sleep.

i think __set_current_state should just be replaced with
set_current_state which provides the appropriate memory barrier ?

kind regards
anupam

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-07-01 13:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-01 13:22 [Kernel-janitors] doubt in drivers/usb/class/audio.c Anupam Kapoor

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.