Skip to content

Commit cbbb057

Browse files
RoelKluintiwai
authored andcommitted
ALSA: allocation may fail in snd_pcm_oss_change_params()
Allocation may fail, show if it did. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> [Additional fix for invalid runtime->oss.prepare flag set by tiwai] Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent f1d269b commit cbbb057

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎sound/core/oss/pcm_oss.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,10 +1043,15 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
10431043
runtime->oss.channels = params_channels(params);
10441044
runtime->oss.rate = params_rate(params);
10451045

1046-
runtime->oss.params = 0;
1047-
runtime->oss.prepare = 1;
10481046
vfree(runtime->oss.buffer);
10491047
runtime->oss.buffer = vmalloc(runtime->oss.period_bytes);
1048+
if (!runtime->oss.buffer) {
1049+
err = -ENOMEM;
1050+
goto failure;
1051+
}
1052+
1053+
runtime->oss.params = 0;
1054+
runtime->oss.prepare = 1;
10501055
runtime->oss.buffer_used = 0;
10511056
if (runtime->dma_area)
10521057
snd_pcm_format_set_silence(runtime->format, runtime->dma_area, bytes_to_samples(runtime, runtime->dma_bytes));

0 commit comments

Comments
 (0)