提交 4f50b41f 编写于 作者: D Dan Carpenter 提交者: Takashi Iwai

ALSA: echoaudio: use after free on error

There are some places where we dereference "chip" in the error message
but we've already freed it.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 7cf9bb21
...@@ -1990,8 +1990,8 @@ static int snd_echo_create(struct snd_card *card, ...@@ -1990,8 +1990,8 @@ static int snd_echo_create(struct snd_card *card,
if ((chip->iores = request_mem_region(chip->dsp_registers_phys, sz, if ((chip->iores = request_mem_region(chip->dsp_registers_phys, sz,
ECHOCARD_NAME)) == NULL) { ECHOCARD_NAME)) == NULL) {
snd_echo_free(chip);
dev_err(chip->card->dev, "cannot get memory region\n"); dev_err(chip->card->dev, "cannot get memory region\n");
snd_echo_free(chip);
return -EBUSY; return -EBUSY;
} }
chip->dsp_registers = (volatile u32 __iomem *) chip->dsp_registers = (volatile u32 __iomem *)
...@@ -1999,8 +1999,8 @@ static int snd_echo_create(struct snd_card *card, ...@@ -1999,8 +1999,8 @@ static int snd_echo_create(struct snd_card *card,
if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED, if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
KBUILD_MODNAME, chip)) { KBUILD_MODNAME, chip)) {
snd_echo_free(chip);
dev_err(chip->card->dev, "cannot grab irq\n"); dev_err(chip->card->dev, "cannot grab irq\n");
snd_echo_free(chip);
return -EBUSY; return -EBUSY;
} }
chip->irq = pci->irq; chip->irq = pci->irq;
...@@ -2012,8 +2012,8 @@ static int snd_echo_create(struct snd_card *card, ...@@ -2012,8 +2012,8 @@ static int snd_echo_create(struct snd_card *card,
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
sizeof(struct comm_page), sizeof(struct comm_page),
&chip->commpage_dma_buf) < 0) { &chip->commpage_dma_buf) < 0) {
snd_echo_free(chip);
dev_err(chip->card->dev, "cannot allocate the comm page\n"); dev_err(chip->card->dev, "cannot allocate the comm page\n");
snd_echo_free(chip);
return -ENOMEM; return -ENOMEM;
} }
chip->comm_page_phys = chip->commpage_dma_buf.addr; chip->comm_page_phys = chip->commpage_dma_buf.addr;
...@@ -2291,8 +2291,8 @@ static int snd_echo_resume(struct device *dev) ...@@ -2291,8 +2291,8 @@ static int snd_echo_resume(struct device *dev)
if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED, if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
KBUILD_MODNAME, chip)) { KBUILD_MODNAME, chip)) {
snd_echo_free(chip);
dev_err(chip->card->dev, "cannot grab irq\n"); dev_err(chip->card->dev, "cannot grab irq\n");
snd_echo_free(chip);
return -EBUSY; return -EBUSY;
} }
chip->irq = pci->irq; chip->irq = pci->irq;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册