summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Osterhoff <linux-kernel@k-raum.org>2015-08-24 14:11:39 +0200
committerTakashi Iwai <tiwai@suse.de>2015-08-24 15:02:03 +0200
commitc7e69ae6b4ff49edf50180c0a32f3dd9d7967e31 (patch)
treea9bed7c211f32527244073be24275669f87274b6
parentALSA: hda - Shutdown CX20722 on reboot/free to avoid spurious noises (diff)
downloadlinux-c7e69ae6b4ff49edf50180c0a32f3dd9d7967e31.tar.xz
linux-c7e69ae6b4ff49edf50180c0a32f3dd9d7967e31.zip
ALSA: hda: fix possible NULL dereference
After a for-loop was replaced by list_for_each_entry, see Commit bbbc7e8502c9 ("ALSA: hda - Allocate hda_pcm objects dynamically"), Commit 751e2216899c ("ALSA: hda: fix possible null dereference"), a possible NULL pointer dereference has been introduced; this patch adds the NULL check on pcm->pcm, while leaving a potentially superfluous check on pcm itself untouched. Signed-off-by: Markus Osterhoff <linux-kernel@k-raum.org> Cc: <stable@vger.kernel.org> #v4.1+ Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_codec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 5de3c5d8c2c0..d1a2cb65e27c 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -3172,7 +3172,7 @@ static int add_std_chmaps(struct hda_codec *codec)
struct snd_pcm_chmap *chmap;
const struct snd_pcm_chmap_elem *elem;
- if (!pcm || pcm->own_chmap ||
+ if (!pcm || !pcm->pcm || pcm->own_chmap ||
!hinfo->substreams)
continue;
elem = hinfo->chmap ? hinfo->chmap : snd_pcm_std_chmaps;