瀏覽代碼

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: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 15 年之前
父節點
當前提交
b82855a0d7
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      sound/pci/hda/hda_codec.c

+ 3 - 0
sound/pci/hda/hda_codec.c

@@ -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) {