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] [day] [month] [year] [list]
Message-ID: <069ce949-bc78-7bfa-686c-ba3f72c7e431@ti.com>
Date:   Thu, 26 May 2022 20:28:54 +0530
From:   "J, KEERTHY" <j-keerthy@...com>
To:     Bryan Brattlof <bb@...com>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Amit Kucheria <amitk@...nel.org>,
        Zhang Rui <rui.zhang@...el.com>
CC:     <linux-pm@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] thermal: k3_j72xx_bandgap: Fix ref_table memory leak
 during probe



On 5/26/2022 3:06 AM, Bryan Brattlof wrote:
> If an error occurs in the k3_j72xx_bandgap_probe() function the memory
> allocated to the 'ref_table' will not be released.
> 
> Add a err_free_ref_table step to the error path to free 'ref_table'

Reviewed-by: Keerthy <j-keerthy@...com>

> 
> Fixes: 72b3fc61c752 ("thermal: k3_j72xx_bandgap: Add the bandgap driver support")
> Reported-by: kernel test robot <lkp@...el.com>
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Signed-off-by: Bryan Brattlof <bb@...com>
> ---
>   drivers/thermal/k3_j72xx_bandgap.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/thermal/k3_j72xx_bandgap.c b/drivers/thermal/k3_j72xx_bandgap.c
> index 64e3231589527..3a35aa38ff512 100644
> --- a/drivers/thermal/k3_j72xx_bandgap.c
> +++ b/drivers/thermal/k3_j72xx_bandgap.c
> @@ -433,7 +433,7 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
>   				     GFP_KERNEL);
>   	if (!derived_table) {
>   		ret = -ENOMEM;
> -		goto err_alloc;
> +		goto err_free_ref_table;
>   	}
>   
>   	/* Workaround not needed if bit30/bit31 is set even for J721e */
> @@ -483,7 +483,7 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
>   		if (IS_ERR(ti_thermal)) {
>   			dev_err(bgp->dev, "thermal zone device is NULL\n");
>   			ret = PTR_ERR(ti_thermal);
> -			goto err_alloc;
> +			goto err_free_ref_table;
>   		}
>   	}
>   
> @@ -514,6 +514,9 @@ static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
>   
>   	return 0;
>   
> +err_free_ref_table:
> +	kfree(ref_table);
> +
>   err_alloc:
>   	pm_runtime_put_sync(&pdev->dev);
>   	pm_runtime_disable(&pdev->dev);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ