diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-05-19 10:30:35 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2007-05-31 03:06:02 -0400 |
commit | 2704364248378193a24505e414dbfd4201053349 (patch) | |
tree | a450aaa299dd3bb5fc596c7f0d7f19aab73f58d5 /sound/pci | |
parent | 3b542985edeed1a1af124ee055e2d35a30489d93 (diff) |
[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>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/ali5451/ali5451.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index e1ed59549c50..cb59f994c68f 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c | |||
@@ -1250,7 +1250,7 @@ static int snd_ali_playback_hw_params(struct snd_pcm_substream *substream, | |||
1250 | evoice->substream = substream; | 1250 | evoice->substream = substream; |
1251 | } | 1251 | } |
1252 | } else { | 1252 | } else { |
1253 | if (!evoice) { | 1253 | if (evoice) { |
1254 | snd_ali_free_voice(codec, evoice); | 1254 | snd_ali_free_voice(codec, evoice); |
1255 | pvoice->extra = evoice = NULL; | 1255 | pvoice->extra = evoice = NULL; |
1256 | } | 1256 | } |
@@ -1267,7 +1267,7 @@ static int snd_ali_playback_hw_free(struct snd_pcm_substream *substream) | |||
1267 | struct snd_ali_voice *evoice = pvoice ? pvoice->extra : NULL; | 1267 | struct snd_ali_voice *evoice = pvoice ? pvoice->extra : NULL; |
1268 | 1268 | ||
1269 | snd_pcm_lib_free_pages(substream); | 1269 | snd_pcm_lib_free_pages(substream); |
1270 | if (!evoice) { | 1270 | if (evoice) { |
1271 | snd_ali_free_voice(codec, evoice); | 1271 | snd_ali_free_voice(codec, evoice); |
1272 | pvoice->extra = NULL; | 1272 | pvoice->extra = NULL; |
1273 | } | 1273 | } |
@@ -1356,7 +1356,7 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream) | |||
1356 | VOL, | 1356 | VOL, |
1357 | CTRL, | 1357 | CTRL, |
1358 | EC); | 1358 | EC); |
1359 | if (!evoice) { | 1359 | if (evoice) { |
1360 | evoice->count = pvoice->count; | 1360 | evoice->count = pvoice->count; |
1361 | evoice->eso = pvoice->count << 1; | 1361 | evoice->eso = pvoice->count << 1; |
1362 | ESO = evoice->eso - 1; | 1362 | ESO = evoice->eso - 1; |