Commit 60686aa0 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: Fix SNDCTL_DSP_RESET ioctl for OSS emulation

In OSS emulation, SNDCTL_DSP_RESET ioctl needs the reset of the internal
buffer state in addition to drop of the running streams.  Otherwise the
succeeding access becomes inconsistent.
Tested-by: default avatarAmit Nagal <helloin.amit@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent ac70eb13
...@@ -1510,16 +1510,19 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use ...@@ -1510,16 +1510,19 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use
static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file) static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file)
{ {
struct snd_pcm_substream *substream; struct snd_pcm_substream *substream;
struct snd_pcm_runtime *runtime;
int i;
substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; for (i = 0; i < 2; i++) {
if (substream != NULL) { substream = pcm_oss_file->streams[i];
snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); if (!substream)
substream->runtime->oss.prepare = 1; continue;
} runtime = substream->runtime;
substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE];
if (substream != NULL) {
snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
substream->runtime->oss.prepare = 1; runtime->oss.prepare = 1;
runtime->oss.buffer_used = 0;
runtime->oss.prev_hw_ptr_period = 0;
runtime->oss.period_ptr = 0;
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment