Skip to content

Commit

Permalink
ALSA: hda - Fix NULL dereference in snd_hda_gen_build_controls()
Browse files Browse the repository at this point in the history
When no controls are assigned in the parser (e.g. no analog path),
spec->kctls.list is still NULL.  We need to check it before passing to
snd_hda_add_new_ctls().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Jan 12, 2013
1 parent 9eb413e commit 36502d0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sound/pci/hda/hda_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2906,9 +2906,11 @@ int snd_hda_gen_build_controls(struct hda_codec *codec)
struct hda_gen_spec *spec = codec->spec;
int err;

err = snd_hda_add_new_ctls(codec, spec->kctls.list);
if (err < 0)
return err;
if (spec->kctls.used) {
err = snd_hda_add_new_ctls(codec, spec->kctls.list);
if (err < 0)
return err;
}

if (spec->multiout.dig_out_nid) {
err = snd_hda_create_dig_out_ctls(codec,
Expand Down

0 comments on commit 36502d0

Please sign in to comment.