Skip to content

Commit

Permalink
ALSA: n64: check return value after calling platform_get_resource()
Browse files Browse the repository at this point in the history
[ Upstream commit be471fe ]

It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210610124958.116142-1-yangyingliang@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yang Yingliang authored and gregkh committed Jul 20, 2021
1 parent 5f9741a commit 2955c54
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sound/mips/snd-n64.c
Expand Up @@ -338,6 +338,10 @@ static int __init n64audio_probe(struct platform_device *pdev)
strcpy(card->longname, "N64 Audio");

res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) {
err = -EINVAL;
goto fail_dma_alloc;
}
if (devm_request_irq(&pdev->dev, res->start, n64audio_isr,
IRQF_SHARED, "N64 Audio", priv)) {
err = -EBUSY;
Expand Down

0 comments on commit 2955c54

Please sign in to comment.