Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Quan Sun <2022090917019@std.uestc.edu.cn>
Cc: linux-sound@vger.kernel.org, perex@perex.cz, tiwai@suse.com,
	thorsten.blum@linux.dev, ian_minett@creativelabs.com
Subject: Re: [PATCH] ALSA: hda: Fix NULL pointer dereference in snd_hda_ctl_add()
Date: Fri, 15 May 2026 09:09:23 +0200	[thread overview]
Message-ID: <87zf21taho.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260514132245.3062884-1-2022090917019@std.uestc.edu.cn>

On Thu, 14 May 2026 15:22:45 +0200,
Quan Sun wrote:
> 
> snd_hda_ctl_add() dereferences kctl->id.subdevice without checking
> whether kctl is NULL. Multiple callers in sound/hda/codecs/ca0132.c
> pass the return value of snd_ctl_new1() directly to snd_hda_ctl_add()
> without a NULL check:
> 
>     return snd_hda_ctl_add(codec, nid, snd_ctl_new1(&knew, codec));
> 
> snd_ctl_new1() returns NULL when the underlying snd_ctl_new() fails
> on memory allocation (kzalloc_flex),which can occur under memory
> pressure or via fault injection.
> 
> Add a NULL check at the entry of snd_hda_ctl_add(), matching the
> pattern already used by snd_ctl_add_replace() at the same call
> path (sound/core/control.c:515). Return -EINVAL to let callers
> handle the error gracefully.
> 
> Fixes: 44f0c9782cc6 ("ALSA: hda/ca0132: Add tuning controls")
> Signed-off-by: Quan Sun <2022090917019@std.uestc.edu.cn>

Applied now.  Thanks.


Takashi

      reply	other threads:[~2026-05-15  7:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14 13:22 [PATCH] ALSA: hda: Fix NULL pointer dereference in snd_hda_ctl_add() Quan Sun
2026-05-15  7:09 ` Takashi Iwai [this message]

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=87zf21taho.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=2022090917019@std.uestc.edu.cn \
    --cc=ian_minett@creativelabs.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=thorsten.blum@linux.dev \
    --cc=tiwai@suse.com \
    /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