From: Ruoyu Wang <ruoyuw560@gmail.com>
To: tiwai@suse.de
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
Ruoyu Wang <ruoyuw560@gmail.com>
Subject: [PATCH] ALSA: ice1712: check pro S/PDIF control allocations
Date: Sun, 7 Jun 2026 10:56:11 +0800 [thread overview]
Message-ID: <20260607025613.3604194-7-ruoyuw560@gmail.com> (raw)
In-Reply-To: <20260607025613.3604194-1-ruoyuw560@gmail.com>
snd_ice1712_spdif_build_controls() creates pro S/PDIF controls and then
sets kctl->id.device before calling snd_ctl_add(). snd_ctl_new1() can
return NULL on allocation failure, making the device-id write a NULL
pointer dereference.
Check each control allocation before using the returned pointer.
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
---
sound/pci/ice1712/ice1712.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 1e39b985bef26..4cec56769c0f6 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -2346,21 +2346,29 @@ int snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice)
if (snd_BUG_ON(!ice->pcm_pro))
return -EIO;
kctl = snd_ctl_new1(&snd_ice1712_spdif_default, ice);
+ if (!kctl)
+ return -ENOMEM;
kctl->id.device = ice->pcm_pro->device;
err = snd_ctl_add(ice->card, kctl);
if (err < 0)
return err;
kctl = snd_ctl_new1(&snd_ice1712_spdif_maskc, ice);
+ if (!kctl)
+ return -ENOMEM;
kctl->id.device = ice->pcm_pro->device;
err = snd_ctl_add(ice->card, kctl);
if (err < 0)
return err;
kctl = snd_ctl_new1(&snd_ice1712_spdif_maskp, ice);
+ if (!kctl)
+ return -ENOMEM;
kctl->id.device = ice->pcm_pro->device;
err = snd_ctl_add(ice->card, kctl);
if (err < 0)
return err;
kctl = snd_ctl_new1(&snd_ice1712_spdif_stream, ice);
+ if (!kctl)
+ return -ENOMEM;
kctl->id.device = ice->pcm_pro->device;
err = snd_ctl_add(ice->card, kctl);
if (err < 0)
--
2.34.1
next prev parent reply other threads:[~2026-06-07 2:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 2:56 [PATCH 0/8] ALSA: check snd_ctl_new1() return before dereferencing Ruoyu Wang
2026-06-07 2:56 ` [PATCH] ALSA: es18xx: check control allocation before private data setup Ruoyu Wang
2026-06-07 2:56 ` [PATCH] ALSA: gus: check PCM volume control allocation Ruoyu Wang
2026-06-07 2:56 ` [PATCH] ALSA: cmipci: check S/PDIF control allocations Ruoyu Wang
2026-06-07 2:56 ` [PATCH] ALSA: es1938: check control allocation before private data setup Ruoyu Wang
2026-06-07 2:56 ` [PATCH] ALSA: ice1712: aureon: check CS8415 control allocation Ruoyu Wang
2026-06-07 2:56 ` Ruoyu Wang [this message]
2026-06-07 2:56 ` [PATCH] ALSA: ice1724: check S/PDIF control allocations Ruoyu Wang
2026-06-07 2:56 ` [PATCH] ALSA: ymfpci: " Ruoyu Wang
2026-06-07 7:27 ` [PATCH 0/8] ALSA: check snd_ctl_new1() return before dereferencing Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260607025613.3604194-7-ruoyuw560@gmail.com \
--to=ruoyuw560@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®