lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 6 Sep 2011 20:07:36 -0700
From:	Arjan van de Ven <arjan@...radead.org>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
	perex@...ex.cz, tiwai@...e.de
Subject: Re: [PATCH] sound: Fix race condition in the pcm_lib "wait for
 space loop

On Tue, 6 Sep 2011 15:59:54 -0700
Andrew Morton <akpm@...ux-foundation.org> wrote:

> > --- a/sound/core/pcm_lib.c
> > +++ b/sound/core/pcm_lib.c
> > @@ -1761,6 +1761,10 @@ static int wait_for_avail(struct
> > snd_pcm_substream *substream, snd_pcm_uframes_t avail = 0;
> >  	long wait_time, tout;
> >  
> > +	init_waitqueue_entry(&wait, current);
> > +	add_wait_queue(&runtime->tsleep, &wait);
> > +	set_current_state(TASK_INTERRUPTIBLE);
> 
> Well, this isn't very good either.  if a wakeup gets delivered to
> runtime->tsleep before the set_current_state(), this process will go
> ahead and incorrectly set itself into TASK_INTERRUPTIBLE state.

... and then check the condition for exit, and then set it to
TASK_RUNABLE a the end...

> 
> That looks like it will be dont-care/cant-happen in this case, but
> it's setting a bad example.

agreed that your ordering is more clean/better.....



-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists