All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anupam Kapoor <anupam.kapoor@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: [Kernel-janitors] doubt in drivers/usb/class/audio.c
Date: Thu, 01 Jul 2004 13:22:49 +0000	[thread overview]
Message-ID: <e3177630407010610608b87e9@mail.gmail.com> (raw)

[-- 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

                 reply	other threads:[~2004-07-01 13:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=e3177630407010610608b87e9@mail.gmail.com \
    --to=anupam.kapoor@gmail.com \
    --cc=kernel-janitors@vger.kernel.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 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.