linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] ALSA: n64: check return value after calling platform_get_resource()
@ 2021-06-10 12:49 Yang Yingliang
  2021-06-12  7:31 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2021-06-10 12:49 UTC (permalink / raw)
  To: linux-kernel, alsa-devel; +Cc: tiwai

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>
---
 sound/mips/snd-n64.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/mips/snd-n64.c b/sound/mips/snd-n64.c
index e35e93157755..463a6fe589eb 100644
--- a/sound/mips/snd-n64.c
+++ b/sound/mips/snd-n64.c
@@ -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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] ALSA: n64: check return value after calling platform_get_resource()
  2021-06-10 12:49 [PATCH -next] ALSA: n64: check return value after calling platform_get_resource() Yang Yingliang
@ 2021-06-12  7:31 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2021-06-12  7:31 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-kernel, alsa-devel, tiwai

On Thu, 10 Jun 2021 14:49:58 +0200,
Yang Yingliang wrote:
> 
> 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>

Thanks, applied.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-12  7:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10 12:49 [PATCH -next] ALSA: n64: check return value after calling platform_get_resource() Yang Yingliang
2021-06-12  7:31 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).