freebsd-dev/sys/dev/sound/pcm
Don Lewis 12e524a290 Change KASSERT() in feed_vchan16() into an explicit test and call to
panic() so that the buffer overflow just beyond this point is always
caught, even when the code is not compiled with INVARIANTS.

Change chn_setblocksize() buffer reallocation code to attempt to avoid
the feed_vchan16() buffer overflow by attempting to always keep the
bufsoft buffer at least as large as the bufhard buffer.

Print a diagnositic message
	Danger! %s bufsoft size increasing from %d to %d after CHANNEL_SETBLOCKSIZE()
if our best attempts fail.  If feed_vchan16() were to be called by
the interrupt handler while locks are dropped in chn_setblocksize()
to increase the size bufsoft to match the size of bufhard, the panic()
code in feed_vchan16() will be triggered.  If the diagnostic message
is printed, it is a warning that a panic is possible if the system
were to see events in an "unlucky" order.

Change the locking code to avoid the need for MTX_RECURSIVE mutexes.

Add the MTX_DUPOK option to the channel mutexes and change the locking
sequence to always lock the parent channel before its children to avoid
the possibility of deadlock.

Actually implement locking assertions for the channel mutexes and fix
the problems found by the resulting assertion violations.

Clean up the locking code in dsp_ioctl().

Allocate the channel buffers using the malloc() M_WAITOK option instead
of M_NOWAIT so that buffer allocation won't fail.  Drop locks across
the malloc() calls.

Add/modify KASSERTS() in attempt to detect problems early.

Abuse layering by adding a pointer to the snd_dbuf structure that points
back to the pcm_channel that owns it.  This allows sndbuf_resize() to do
proper locking without having to change the its API, which is used by
the hardware drivers.

Don't dereference a NULL pointer when setting hw.snd.maxautovchans
if a hardware driver is not loaded.  Noticed by Ryan Sommers
<ryans at gamersimpact.com>.

Tested by:	Stefan Ehmann <shoesoft AT gmx.net>
Tested by:	matk (Mathew Kanner)
Tested by:	Gordon Bergling <gbergling AT 0xfce3.net>
2004-01-28 08:02:15 +00:00
..
ac97_if.m
ac97_patch.c
ac97_patch.h
ac97.c Sync with DFBSD v.1.16. Add new codecs IDs, fix some spelling. 2004-01-23 16:38:54 +00:00
ac97.h
buffer.c Change KASSERT() in feed_vchan16() into an explicit test and call to 2004-01-28 08:02:15 +00:00
buffer.h Change KASSERT() in feed_vchan16() into an explicit test and call to 2004-01-28 08:02:15 +00:00
channel_if.m
channel.c Change KASSERT() in feed_vchan16() into an explicit test and call to 2004-01-28 08:02:15 +00:00
channel.h Change KASSERT() in feed_vchan16() into an explicit test and call to 2004-01-28 08:02:15 +00:00
dsp.c Change KASSERT() in feed_vchan16() into an explicit test and call to 2004-01-28 08:02:15 +00:00
dsp.h Fix a panic when kldloading a sound driver. Do this by replacing the 2004-01-20 03:58:57 +00:00
fake.c
feeder_fmt.c
feeder_if.m
feeder_rate.c
feeder.c
feeder.h
mixer_if.m
mixer.c As previously announced: discontinue use of makedev() call in soundcode. 2004-01-17 10:37:11 +00:00
mixer.h
sndstat.c The last argument to mtx_init() should be MTX_DEF, not 0. This is not a 2003-12-08 01:08:03 +00:00
sound.c Change KASSERT() in feed_vchan16() into an explicit test and call to 2004-01-28 08:02:15 +00:00
sound.h Change KASSERT() in feed_vchan16() into an explicit test and call to 2004-01-28 08:02:15 +00:00
vchan.c Change KASSERT() in feed_vchan16() into an explicit test and call to 2004-01-28 08:02:15 +00:00
vchan.h