[ALSA] Fix Oops of PCM OSS emulation
authorTakashi Iwai <tiwai@suse.de>
Thu, 6 Apr 2006 17:47:42 +0000 (19:47 +0200)
committerJaroslav Kysela <perex@suse.cz>
Wed, 12 Apr 2006 09:34:04 +0000 (11:34 +0200)
Modules: PCM Midlevel,ALSA<-OSS emulation

Fix Oops of PCM OSS emulation occuring when multiple playback is used.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/pcm.h
sound/core/oss/pcm_oss.c
sound/core/pcm_native.c

index 66b1f08b42b90a79921135a487474b10802d80ec..e9ab45556afadb693155d502558bf67a8bb8dcd2 100644 (file)
@@ -367,7 +367,7 @@ struct snd_pcm_substream {
        struct snd_pcm_group self_group;        /* fake group for non linked substream (with substream lock inside) */
        struct snd_pcm_group *group;            /* pointer to current group */
        /* -- assigned files -- */
-       struct snd_pcm_file *file;
+       void *file;
        struct file *ffile;
        void (*pcm_release)(struct snd_pcm_substream *);
 #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
index 7c0c4e1d694321637f90d2fced48c89150e948b2..c5978d6c6080777246d989293ad2ef1684833cbb 100644 (file)
@@ -1682,7 +1682,7 @@ static void snd_pcm_oss_init_substream(struct snd_pcm_substream *substream,
        substream->oss.setup = *setup;
        if (setup->nonblock)
                substream->ffile->f_flags |= O_NONBLOCK;
-       else
+       else if (setup->block)
                substream->ffile->f_flags &= ~O_NONBLOCK;
        runtime = substream->runtime;
        runtime->oss.params = 1;
@@ -1757,6 +1757,7 @@ static int snd_pcm_oss_open_file(struct file *file,
                }
 
                pcm_oss_file->streams[idx] = substream;
+               substream->file = pcm_oss_file;
                snd_pcm_oss_init_substream(substream, &setup[idx], minor);
        }
        
@@ -1809,7 +1810,7 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
                err = -EFAULT;
                goto __error;
        }
-       memset(setup, 0, sizeof(*setup));
+       memset(setup, 0, sizeof(setup));
        if (file->f_mode & FMODE_WRITE)
                snd_pcm_oss_look_for_setup(pcm, SNDRV_PCM_STREAM_PLAYBACK,
                                           task_name, &setup[0]);
index 964e4c47a7f1986a0cb031ab51375b5e0668fbf4..0860c5a84502f6f67451cdea60a566b639fdbf9b 100644 (file)
@@ -2007,14 +2007,16 @@ static void pcm_release_private(struct snd_pcm_substream *substream)
 void snd_pcm_release_substream(struct snd_pcm_substream *substream)
 {
        snd_pcm_drop(substream);
-       if (substream->pcm_release)
-               substream->pcm_release(substream);
        if (substream->hw_opened) {
                if (substream->ops->hw_free != NULL)
                        substream->ops->hw_free(substream);
                substream->ops->close(substream);
                substream->hw_opened = 0;
        }
+       if (substream->pcm_release) {
+               substream->pcm_release(substream);
+               substream->pcm_release = NULL;
+       }
        snd_pcm_detach_substream(substream);
 }