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>] [day] [month] [year] [list]
Date:   Tue, 18 Jul 2023 14:17:35 +0200
From:   Takashi Iwai <tiwai@...e.de>
To:     Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>
Cc:     alsa-devel@...a-project.org, sound-open-firmware@...a-project.org,
        linux-kernel@...r.kernel.org, Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>,
        Cezary Rojewski <cezary.rojewski@...el.com>,
        Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
        Liam Girdwood <liam.r.girdwood@...ux.intel.com>,
        Peter Ujfalusi <peter.ujfalusi@...ux.intel.com>,
        Bard Liao <yung-chuan.liao@...ux.intel.com>,
        Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
        Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
        Mark Brown <broonie@...nel.org>,
        Daniel Baluta <daniel.baluta@....com>
Subject: Re: [v2 PATCH 1/2] ALSA: hda/intel: Fix error handling in azx_probe()

On Tue, 18 Jul 2023 13:57:33 +0200,
Maarten Lankhorst wrote:
> 
> 
> Make sure azx is freed after azx_create() succeeded and an error was
> encountered.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>
> ---
>  sound/pci/hda/hda_intel.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> index 5af1138e745bc..196ca76ac43ad 100644
> --- a/sound/pci/hda/hda_intel.c
> +++ b/sound/pci/hda/hda_intel.c
> @@ -2150,7 +2150,7 @@ static int azx_probe(struct pci_dev *pci,
>                       err = register_vga_switcheroo(chip);
>                       if (err < 0) {
>                                             dev_err(card->dev, "Error registering vga_switcheroo client\n");
> -                                           goto out_free;
> +                                           goto out_azx_free;
>                       }
>  
>                       if (check_hdmi_disabled(pci)) {
> @@ -2169,7 +2169,7 @@ static int azx_probe(struct pci_dev *pci,
>                                                                                                                     &pci->dev, GFP_KERNEL, card,
>                                                                                                                     azx_firmware_cb);
>                                             if (err < 0)
> -                                                                 goto out_free;
> +                                                                 goto out_azx_free;
>                                             schedule_probe = false; /* continued in azx_firmware_cb() */
>                       }
>  #endif /* CONFIG_SND_HDA_PATCH_LOADER */
> @@ -2187,6 +2187,9 @@ static int azx_probe(struct pci_dev *pci,
>                                             complete_all(&hda->probe_wait);
>                       return 0;
>  
> +out_azx_free:
> +                     azx_free(chip);

This is superfluous.  Once when azx_create() succeeds, azx_free() is
called from snd_card_free().  That is...

> +                     pci_set_drvdata(pci, NULL);

... only this call was missing.  And this can be put under out_free 
label, as this is safe to call at any exit path.  So, it'll be a
oneliner patch.


thanks,

Takashi

>  out_free:
>                       snd_card_free(card);
>                       return err;
> -- 
> 2.39.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ