Skip to content

Commit 7615f51

Browse files
ajitkupandeyplbossart
authored andcommitted
ASoC: SOF: Fix NULL pointer exception in sof_pci_probe callback
We are accessing "desc->ops" in sof_pci_probe without checking "desc" pointer. This results in NULL pointer exception if pci_id->driver_data i.e desc pointer isn't defined in sof device probe: BUG: kernel NULL pointer dereference, address: 0000000000000060 PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP NOPTI RIP: 0010:sof_pci_probe+0x1e/0x17f [snd_sof_pci] Code: Unable to access opcode bytes at RIP 0xffffffffc043dff4. RSP: 0018:ffffac4b03b9b8d8 EFLAGS: 00010246 Add NULL pointer check for sof_dev_desc pointer to avoid such exception. Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
1 parent 0e357b5 commit 7615f51

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

sound/soc/sof/sof-pci-dev.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
187187

188188
dev_dbg(&pci->dev, "PCI DSP detected");
189189

190+
if (!desc) {
191+
dev_err(dev, "error: no matching PCI descriptor\n");
192+
return -ENODEV;
193+
}
194+
190195
if (!desc->ops) {
191196
dev_err(dev, "error: no matching PCI descriptor ops\n");
192197
return -ENODEV;

0 commit comments

Comments
 (0)