All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benny Sjostrand <gorm@cucumelo.org>
To: alsa-devel@lists.sourceforge.net
Subject: [BUG ?] Crash in the cs46xx driver when using alsaplayer
Date: Mon, 12 Aug 2002 20:59:48 +0200	[thread overview]
Message-ID: <3D5805A4.5020008@cucumelo.org> (raw)

Hi!

Using the alsaplayer with the cs46xx driver causes a oops when closing 
the alsaplayer, playing mp3, wav, CD's etc with the
alsaplayer works fine. All other applications that i've tested this dont 
happens OSS stuff like XMMS, aplay, acrecord, jackit.

Soiling all over the code with a lot of snd_printdd finally i've 
discovered the cause of the crash, and it's not cause of my patches to 
the cs46xx driver, it will probably happen even without 
CONFIG_SND_CS46XX_NEW_DSP defined.

So, when alsaplayer is closing the snd_cs46xx_playback_hw_free(...) is 
invoked, and after that the for some reason the 
snd_cs46xx_playback_copy(...) is invoked, and then runtime->dma_area == 
NULL which causes a kernel "oops" when copy_from_user(...) is invoked 
from snd_cs46xx_playback_copy(...)

Let's take a look at snd_cs46xx_playback_hw_free(...):

static int snd_cs46xx_playback_hw_free(snd_pcm_substream_t * substream)
{
    /*cs46xx_t *chip = snd_pcm_substream_chip(substream);*/
    snd_pcm_runtime_t *runtime = substream->runtime;
    cs46xx_pcm_t *cpcm;

    cpcm = snd_magic_cast(cs46xx_pcm_t, runtime->private_data, return 
-ENXIO);

    if (runtime->dma_area != cpcm->hw_area)
        snd_pcm_lib_free_pages(substream);
   
    runtime->dma_area = NULL;
    runtime->dma_addr = 0;
    runtime->dma_bytes = 0;

    return 0;
}

and then snd_cs46xx_playback_copy(...):

static int snd_cs46xx_playback_copy(snd_pcm_substream_t *substream,
                    int channel,
                    snd_pcm_uframes_t hwoff,
                    void *src,
                    snd_pcm_uframes_t frames)
{
    snd_pcm_runtime_t *runtime = substream->runtime;
    /*cs46xx_t *chip = snd_pcm_substream_chip(substream); */
    size_t hwoffb;
    size_t bytes;
    char *hwbuf;
    cs46xx_pcm_t *cpcm = snd_magic_cast(cs46xx_pcm_t, 
substream->runtime->private_data, return -ENXIO);

    hwoffb = hwoff << cpcm->shift;
    bytes = frames << cpcm->shift;
    hwbuf = runtime->dma_area + hwoffb;

    if (copy_from_user(hwbuf, src, bytes)) /* It crash here when 
runtime->dma_area == NULL */
        return -EFAULT;

    spin_lock_irq(&runtime->lock);
    snd_cs46xx_playback_transfer(substream, frames);
    spin_unlock_irq(&runtime->lock);
    return 0;
}

Where is BUG ?, or  in cs46xx driver or in the ALSA PCM core somewhere ?,
well, it's easy fixed in snd_cs46xx_playback_copy(...) doing a check.
Then why it only happen with the alsaplayer, just no idea ....

suggestions ... ?? comments .... ??

/Benny



-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31

             reply	other threads:[~2002-08-12 18:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-12 18:59 Benny Sjostrand [this message]
2002-08-12 19:22 ` [BUG ?] Crash in the cs46xx driver when using alsaplayer Jaroslav Kysela
2002-08-12 19:42   ` Benny Sjostrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D5805A4.5020008@cucumelo.org \
    --to=gorm@cucumelo.org \
    --cc=alsa-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.