Skip to content

Commit 6ade657

Browse files
kengitertiwai
authored andcommitted
ALSA: echoaudio: add a check for ioremap_nocache
In case ioremap_nocache fails, the fix releases chip and returns an error code upstream to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent da484d0 commit 6ade657

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

sound/pci/echoaudio/echoaudio.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,6 +1952,11 @@ static int snd_echo_create(struct snd_card *card,
19521952
}
19531953
chip->dsp_registers = (volatile u32 __iomem *)
19541954
ioremap_nocache(chip->dsp_registers_phys, sz);
1955+
if (!chip->dsp_registers) {
1956+
dev_err(chip->card->dev, "ioremap failed\n");
1957+
snd_echo_free(chip);
1958+
return -ENOMEM;
1959+
}
19551960

19561961
if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
19571962
KBUILD_MODNAME, chip)) {

0 commit comments

Comments
 (0)