Skip to content

Commit

Permalink
ALSA: hda - Add sanity check for storing the user-defined pin configs
Browse files Browse the repository at this point in the history
Check whether the given NID is a pin widget before storing the
user-defined pin configs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Dec 27, 2009
1 parent a4e09aa commit b82855a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,9 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list,
struct hda_pincfg *pin;
unsigned int oldcfg;

if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
return -EINVAL;

oldcfg = snd_hda_codec_get_pincfg(codec, nid);
pin = look_up_pincfg(codec, list, nid);
if (!pin) {
Expand Down

0 comments on commit b82855a

Please sign in to comment.