* [PATCH -next] ALSA: n64: check return value after calling platform_get_resource()
@ 2021-06-10 12:49 ` Yang Yingliang
0 siblings, 0 replies; 4+ 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] 4+ messages in thread
* [PATCH -next] ALSA: n64: check return value after calling platform_get_resource()
@ 2021-06-10 12:49 ` Yang Yingliang
0 siblings, 0 replies; 4+ 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] 4+ messages in thread
* Re: [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
-1 siblings, 0 replies; 4+ 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] 4+ messages in thread
* Re: [PATCH -next] ALSA: n64: check return value after calling platform_get_resource()
@ 2021-06-12 7:31 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2021-06-12 7:31 UTC (permalink / raw)
To: Yang Yingliang; +Cc: alsa-devel, linux-kernel, 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] 4+ messages in thread
end of thread, other threads:[~2021-06-12 7:32 UTC | newest]
Thread overview: 4+ 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-10 12:49 ` Yang Yingliang
2021-06-12 7:31 ` Takashi Iwai
2021-06-12 7:31 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.