cvs commit: src/sys/dev/sound/pcm buffer.c buffer.h channel.c channel.h dsp.c sound.c sound.h vchan.c

Don Lewis truckman at FreeBSD.org
Wed Jan 28 00:02:18 PST 2004


truckman    2004/01/28 00:02:15 PST

  FreeBSD src repository

  Modified files:
    sys/dev/sound/pcm    buffer.c buffer.h channel.c channel.h 
                         dsp.c sound.c sound.h vchan.c 
  Log:
  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>
  
  Revision  Changes    Path
  1.22      +40 -17    src/sys/dev/sound/pcm/buffer.c
  1.9       +2 -1      src/sys/dev/sound/pcm/buffer.h
  1.94      +100 -23   src/sys/dev/sound/pcm/channel.c
  1.29      +4 -1      src/sys/dev/sound/pcm/channel.h
  1.72      +16 -75    src/sys/dev/sound/pcm/dsp.c
  1.89      +57 -19    src/sys/dev/sound/pcm/sound.c
  1.55      +1 -0      src/sys/dev/sound/pcm/sound.h
  1.16      +25 -4     src/sys/dev/sound/pcm/vchan.c


More information about the cvs-all mailing list