lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ddc14926-45d8-9b20-9523-0fb6afa499b3@wanadoo.fr>
Date:   Wed, 23 Aug 2023 19:20:49 +0200
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     Su Hui <suhui@...china.com>, perex@...ex.cz, tiwai@...e.com
Cc:     arnd@...db.de, robert.jarzmik@...e.fr, yangyingliang@...wei.com,
        maciej.szmigiero@...cle.com, alsa-devel@...a-project.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] ALSA: ac97: Fix possible error value of *rac97

Le 23/08/2023 à 04:52, Su Hui a écrit :
> Before committing 79597c8bf64c, *rac97 always be NULL if there is
> an error. When error happens, make sure *rac97 is NULL is safer.
> 
> For examble, in snd_vortex_mixer():
> 	err = snd_ac97_mixer(pbus, &ac97, &vortex->codec);
> 	vortex->isquad = ((vortex->codec == NULL) ?
> 		0 : (vortex->codec->ext_id&0x80));
> If error happened but vortex->codec isn't NULL, this may cause some
> problems.
> 
> Move the judgement order to be clearer and better.
> 
> Fixes: 79597c8bf64c ("ALSA: ac97: Fix possible NULL dereference in snd_ac97_mixer")
> Suggested-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> Signed-off-by: Su Hui <suhui@...china.com>
> ---
>   sound/pci/ac97/ac97_codec.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
> index 80a65b8ad7b9..25f93e56cfc7 100644
> --- a/sound/pci/ac97/ac97_codec.c
> +++ b/sound/pci/ac97/ac97_codec.c
> @@ -2069,10 +2069,9 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
>   		.dev_disconnect =	snd_ac97_dev_disconnect,
>   	};
>   
> -	if (!rac97)
> -		return -EINVAL;
> -	if (snd_BUG_ON(!bus || !template))
> +	if (snd_BUG_ON(!bus || !template || !rac97))
>   		return -EINVAL;
> +	*rac97 = NULL;
>   	if (snd_BUG_ON(template->num >= 4))
>   		return -EINVAL;
>   	if (bus->codec[template->num])

FWIW,

Acked-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>

CJ

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ