Skip to content

Commit

Permalink
ALSA: hda: fix possible NULL dereference
Browse files Browse the repository at this point in the history
After a for-loop was replaced by list_for_each_entry, see
Commit bbbc7e8 ("ALSA: hda - Allocate hda_pcm objects dynamically"),
Commit 751e221 ("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>
  • Loading branch information
Markus Osterhoff authored and Takashi Iwai committed Aug 24, 2015
1 parent f6b28e4 commit c7e69ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c7e69ae

Please sign in to comment.