mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-15 15:15:47 +00:00
[ALSA] ali5451 - Fix possible NULL dereference
Reported by Eric Sesterhenn. Fix the wrong checks of extra voice pointer, which may cause NULL dereferences. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
This commit is contained in:
parent
3b542985ed
commit
2704364248
1 changed files with 3 additions and 3 deletions
|
@ -1250,7 +1250,7 @@ static int snd_ali_playback_hw_params(struct snd_pcm_substream *substream,
|
||||||
evoice->substream = substream;
|
evoice->substream = substream;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!evoice) {
|
if (evoice) {
|
||||||
snd_ali_free_voice(codec, evoice);
|
snd_ali_free_voice(codec, evoice);
|
||||||
pvoice->extra = evoice = NULL;
|
pvoice->extra = evoice = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1267,7 +1267,7 @@ static int snd_ali_playback_hw_free(struct snd_pcm_substream *substream)
|
||||||
struct snd_ali_voice *evoice = pvoice ? pvoice->extra : NULL;
|
struct snd_ali_voice *evoice = pvoice ? pvoice->extra : NULL;
|
||||||
|
|
||||||
snd_pcm_lib_free_pages(substream);
|
snd_pcm_lib_free_pages(substream);
|
||||||
if (!evoice) {
|
if (evoice) {
|
||||||
snd_ali_free_voice(codec, evoice);
|
snd_ali_free_voice(codec, evoice);
|
||||||
pvoice->extra = NULL;
|
pvoice->extra = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1356,7 +1356,7 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream)
|
||||||
VOL,
|
VOL,
|
||||||
CTRL,
|
CTRL,
|
||||||
EC);
|
EC);
|
||||||
if (!evoice) {
|
if (evoice) {
|
||||||
evoice->count = pvoice->count;
|
evoice->count = pvoice->count;
|
||||||
evoice->eso = pvoice->count << 1;
|
evoice->eso = pvoice->count << 1;
|
||||||
ESO = evoice->eso - 1;
|
ESO = evoice->eso - 1;
|
||||||
|
|
Loading…
Reference in a new issue