Re: [PATCH v2] ALSA: es18xx: check control allocation before private data setup

From: Takashi Iwai

Date: Sun Jun 07 2026 - 05:46:24 EST


On Sun, 07 Jun 2026 09:42:19 +0200,
Ruoyu Wang wrote:
>
> snd_es18xx_mixer() creates controls with snd_ctl_new1() and then stores
> bookkeeping pointers or sets private_free before calling snd_ctl_add().
> snd_ctl_new1() can return NULL on allocation failure, so those writes
> can dereference a NULL control pointer.
>
> Check the returned control pointers before using them and return -ENOMEM
> on allocation failure.
>
> Signed-off-by: Ruoyu Wang <ruoyuw560@xxxxxxxxx>
> ---
> v2:
> - Rebase on sound.git for-next.
> - Resend only es18xx; the other v1 patches are already in for-next.

Applied to for-next branch now. Thanks.


Takashi