Commit b82855a0 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Add sanity check for storing the user-defined pin configs

Check whether the given NID is a pin widget before storing the
user-defined pin configs.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent a4e09aa3
...@@ -824,6 +824,9 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, ...@@ -824,6 +824,9 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list,
struct hda_pincfg *pin; struct hda_pincfg *pin;
unsigned int oldcfg; unsigned int oldcfg;
if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
return -EINVAL;
oldcfg = snd_hda_codec_get_pincfg(codec, nid); oldcfg = snd_hda_codec_get_pincfg(codec, nid);
pin = look_up_pincfg(codec, list, nid); pin = look_up_pincfg(codec, list, nid);
if (!pin) { if (!pin) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment