summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pcm/buffer.h
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2004-01-28 08:02:15 +0000
committertruckman <truckman@FreeBSD.org>2004-01-28 08:02:15 +0000
commit860115ff61133d494820140aaffe13b6bd0d0256 (patch)
treea74abb2113dfe2f0c468f9e6bf902217071b53f1 /sys/dev/sound/pcm/buffer.h
parent0004b4717fe5160dc86420ca1eca3b19178d4fd7 (diff)
downloadFreeBSD-src-860115ff61133d494820140aaffe13b6bd0d0256.zip
FreeBSD-src-860115ff61133d494820140aaffe13b6bd0d0256.tar.gz
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>
Diffstat (limited to 'sys/dev/sound/pcm/buffer.h')
-rw-r--r--sys/dev/sound/pcm/buffer.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/dev/sound/pcm/buffer.h b/sys/dev/sound/pcm/buffer.h
index 31d9e2b..48981b5 100644
--- a/sys/dev/sound/pcm/buffer.h
+++ b/sys/dev/sound/pcm/buffer.h
@@ -53,10 +53,11 @@ struct snd_dbuf {
bus_dma_tag_t dmatag;
u_int32_t buf_addr;
struct selinfo sel;
+ struct pcm_channel *channel;
char name[SNDBUF_NAMELEN];
};
-struct snd_dbuf *sndbuf_create(device_t dev, char *drv, char *desc);
+struct snd_dbuf *sndbuf_create(device_t dev, char *drv, char *desc, struct pcm_channel *channel);
void sndbuf_destroy(struct snd_dbuf *b);
void sndbuf_dump(struct snd_dbuf *b, char *s, u_int32_t what);
OpenPOWER on IntegriCloud