]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ALSA: echoaudio: add a check for ioremap_nocache
authorKangjie Lu <kjlu@umn.edu>
Fri, 15 Mar 2019 03:58:29 +0000 (22:58 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Apr 2019 07:15:00 +0000 (09:15 +0200)
[ Upstream commit 6ade657d6125ec3ec07f95fa51e28138aef6208f ]

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 <kjlu@umn.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/pci/echoaudio/echoaudio.c

index d68f99e076a879def2241365e0dd78b3aeaa5611..e1f0bcd45c3783efece93c10ad74e21ed2a57dc0 100644 (file)
@@ -1953,6 +1953,11 @@ static int snd_echo_create(struct snd_card *card,
        }
        chip->dsp_registers = (volatile u32 __iomem *)
                ioremap_nocache(chip->dsp_registers_phys, sz);
+       if (!chip->dsp_registers) {
+               dev_err(chip->card->dev, "ioremap failed\n");
+               snd_echo_free(chip);
+               return -ENOMEM;
+       }
 
        if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
                        KBUILD_MODNAME, chip)) {