OSDN Git Service

Revert "Revert "ALSA: pcm: Avoid possible info leaks from PCM stream buffers""
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / sound / core / pcm_native.c
index 7f87e4c..6a5cee1 100644 (file)
@@ -587,6 +587,10 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
                                        LONG_MAX - runtime->buffer_size)
                runtime->boundary *= 2;
 
+       /* clear the buffer for avoiding possible kernel info leaks */
+       if (runtime->dma_area)
+               memset(runtime->dma_area, 0, runtime->dma_bytes);
+
        snd_pcm_timer_resolution_change(substream);
        snd_pcm_set_state(substream, SNDRV_PCM_STATE_SETUP);