opnsense-src/sys
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
..
alpha - Remove local changes that leaked into my last commit. 2004-01-24 21:45:25 +00:00
amd64 MFi386 revision 1.230 2004-01-25 06:19:37 +00:00
arm Add sysentvec->sv_fixlimits() hook so that we can catch cases on 64 bit 2003-09-25 01:10:26 +00:00
boot MFi386: revision 1.33 2004-01-28 04:15:31 +00:00
cam Fix type in comment, 's/writtent/written/' 2004-01-18 00:17:14 +00:00
coda - Implement selwakeuppri() which allows raising the priority of a 2003-11-09 09:17:26 +00:00
compat Implement NdisVirtualBufferAddress() and NdisVirtualBufferAddressSafe(). 2004-01-27 08:10:34 +00:00
conf Add missing 'device ataraid' to support ATA software RAID. 2004-01-26 16:38:33 +00:00
contrib This commit was generated by cvs2svn to compensate for changes in r124528, 2004-01-14 18:54:22 +00:00
crypto Fix a reentrancy issue in md5_calc(). 2004-01-27 18:57:21 +00:00
ddb If not in the debugger or if the user requests it with the 2004-01-28 06:51:18 +00:00
dev Change KASSERT() in feed_vchan16() into an explicit test and call to 2004-01-28 08:02:15 +00:00
fs Fix style(9) of my previous commit. 2004-01-21 18:03:54 +00:00
geom Make sure to keep track of canceled events. 2004-01-23 21:09:38 +00:00
gnu Copy workaround from FFS: open device for write access even if 2004-01-24 08:43:06 +00:00
i4b Based on an excellent suggestion from tanimura@ define I4BPRI and use it 2003-11-10 14:20:34 +00:00
i386 Remove process lock XXX's, fixed in src/sys/sys/proc.h:1.366. 2004-01-28 06:48:31 +00:00
ia64 Sort PFIL_HOOKS. 2004-01-27 20:22:53 +00:00
isa Significantly reduce the "jitter" that is typical for PS/2 mice 2003-12-11 11:28:11 +00:00
isofs/cd9660 Spell magic '16' number as IO_SEQSHIFT. 2004-01-19 20:03:43 +00:00
kern Move the part of the comment which applies to osigsuspend where 2004-01-28 06:06:04 +00:00
libkern Translate from GNU C to ISO C. 2004-01-14 07:47:10 +00:00
modules Always build ext2fs module. There is no written policy preventing the 2004-01-28 04:16:13 +00:00
net Cleanup malloc() use in if_attach(): 2004-01-27 19:35:05 +00:00
net80211 Change WI_RID_SCAN_RES compatibility interface to return the result after 2004-01-19 05:25:43 +00:00
netatalk Eliminate a duplicate free when deleting an interface address. This 2003-11-28 04:19:41 +00:00
netatm Introduce a MAC label reference in 'struct inpcb', which caches 2003-11-18 00:39:07 +00:00
netgraph Correct the description of the net.graph.recvspace sysctl. 2004-01-27 22:02:01 +00:00
netinet Correct the descriptions of the net.inet.{udp,raw}.recvspace sysctls. 2004-01-27 22:17:39 +00:00
netinet6 call ipsec_pcbconn()/ipsec_pcbdisconn() from in6_pcbconnect(). 2004-01-13 10:45:02 +00:00
netipsec o add missing break 2004-01-27 17:45:28 +00:00
netipx Introduce a MAC label reference in 'struct inpcb', which caches 2003-11-18 00:39:07 +00:00
netkey avoid duplicate free. 2004-01-25 17:18:12 +00:00
netnatm Introduce a MAC label reference in 'struct inpcb', which caches 2003-11-18 00:39:07 +00:00
netncp The present defaults for the open and close for device drivers which 2003-09-27 12:01:01 +00:00
netsmb Add support for SMB request signing, which prevents "man in the middle" 2004-01-02 22:38:42 +00:00
nfs University of Michigan's Citi NFSv4 kernel client code. 2003-11-14 20:54:10 +00:00
nfs4client This patch fixes two little portability (to !GCC compilers) problems: 2003-12-11 11:30:26 +00:00
nfsclient Use function pointers to remove the depenancy cross dependancy on nfs4 2003-11-22 02:21:49 +00:00
nfsserver Fix some becuase -> because typos. 2003-12-17 16:12:01 +00:00
opencrypto style(9) pass and type fixups. 2003-12-16 14:13:47 +00:00
pc98 The ataraid device is not needed for pc98. 2004-01-27 15:39:32 +00:00
pccard - Implement selwakeuppri() which allows raising the priority of a 2003-11-09 09:17:26 +00:00
pci Fix multicast and promiscuous mode handling for Yukon devices. 2004-01-21 22:32:15 +00:00
posix4 sched_setscheduler: Return EINVAL when a invalid policy is specified, 2003-09-13 18:46:24 +00:00
powerpc - Recruit some new ULE users by making it the default scheduler in GENERIC. 2004-01-24 21:38:52 +00:00
rpc Don't panic because of RPC proto mismatches. Whitespace cleanup. 2004-01-17 21:25:05 +00:00
security Pay attention to mac_portacl_enabled. 2004-01-20 18:33:02 +00:00
sparc64 - Fix for sparc64 to use new __panic() function 2004-01-27 15:02:18 +00:00
sys Allow the use of a stale p_stops value in STOPEVENT(), grabbing 2004-01-27 20:21:07 +00:00
tools Changes for new SMP-safe kobj method dispatch algorithm. 2003-10-16 13:29:26 +00:00
ufs Turn uio_resid/uio_offset comments into KASSERTs 2004-01-27 11:28:38 +00:00
vm - Add a flags parameter to mi_switch. The value of flags may be SW_VOL or 2004-01-25 03:54:52 +00:00
Makefile Replaced outdated comment. 2004-01-17 03:28:27 +00:00