Skip to content

Commit

Permalink
ALSA: hda/jack - Fix NULL-dereference at probing
Browse files Browse the repository at this point in the history
At probing time, the elements that aren't assigned to kctl or jack may
be called.  Need proper NULL-checks.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Nov 16, 2011
1 parent d1cb620 commit cfc7c9d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sound/pci/hda/hda_jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ void snd_hda_jack_report_sync(struct hda_codec *codec)
for (i = 0; i < codec->jacktbl.used; i++, jack++)
if (jack->nid) {
jack_detect_update(codec, jack);
if (!jack->kctl)
continue;
state = get_jack_plug_state(jack->pin_sense);
snd_kctl_jack_report(codec->bus->card, jack->kctl, state);
}
Expand Down Expand Up @@ -356,7 +358,7 @@ void snd_hda_input_jack_report(struct hda_codec *codec, hda_nid_t nid)
unsigned int present;
int type;

if (!jack)
if (!jack || !jack->jack)
return;

present = snd_hda_jack_detect(codec, nid);
Expand Down

0 comments on commit cfc7c9d

Please sign in to comment.