Skip to contentSkip to conversation

doubt in drivers/usb/class/audio.c

Kernel-janitors Anupam Kapoor 1 participant 1 message Jul 1, 2004 Kernel janitors

lore
Share & tools
lore
#0 lore raw

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

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors