浏览代码

ALSA: Allow pass NULL dev for snd_pci_quirk_lookup()

Add a NULL check in snd_pci_quirk_lookup() so that NULL can be passed
as a pci_dev pointer.  This fixes the possible NULL dereferences in
HD-audio drivers.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 10 年之前
父节点
当前提交
e5b50ada76
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      sound/core/misc.c

+ 2 - 0
sound/core/misc.c

@@ -145,6 +145,8 @@ EXPORT_SYMBOL(snd_pci_quirk_lookup_id);
 const struct snd_pci_quirk *
 snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list)
 {
+	if (!pci)
+		return NULL;
 	return snd_pci_quirk_lookup_id(pci->subsystem_vendor,
 				       pci->subsystem_device,
 				       list);