NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/46121: audiomp: locking protocol error
The following reply was made to PR kern/46121; it has been noted by GNATS.
From: David Laight <david%l8s.co.uk@localhost>
To: matthew green <mrg%eterna.com.au@localhost>
Cc: ad%netbsd.org@localhost, gnats-bugs%NetBSD.org@localhost,
kern-bug-people%netbsd.org@localhost,
gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Subject: Re: kern/46121: audiomp: locking protocol error
Date: Mon, 26 Mar 2012 08:33:01 +0100
On Mon, Mar 26, 2012 at 06:07:02PM +1100, matthew green wrote:
>
> this looks like it should do the trick.
...
> mutex_enter(sc->sc_lock);
> ! can_playback = audio_can_playback(sc);
> ! can_capture = audio_can_capture(sc);
> ! mutex_exit(sc->sc_lock);
> !
> ! if (can_playback) {
Hmmm... that sort of code tends to look dubious [1].
While acquiring a mutex across a function call can protect the underlying
data from immediate corruption, it isn't necessarily obvious that
the checked condition can't change state after the mutex is released.
David
[1] As does releaseing a mutex across a function call!
--
David Laight: david%l8s.co.uk@localhost
Home |
Main Index |
Thread Index |
Old Index