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: <20201102185216.GB13405@kozik-lap>
Date:   Mon, 2 Nov 2020 19:52:16 +0100
From:   Krzysztof Kozlowski <krzk@...nel.org>
To:     Yu Kuai <yukuai3@...wei.com>
Cc:     thierry.reding@...il.com, jonathanh@...dia.com,
        mperttunen@...dia.com, tomeu.vizoso@...labora.com,
        linux-kernel@...r.kernel.org, linux-tegra@...r.kernel.org,
        yi.zhang@...wei.com
Subject: Re: [PATCH] memory: tegra: add missing put_devcie() call in
 tegra_emc_probe()

On Sat, Oct 31, 2020 at 06:53:55PM +0800, Yu Kuai wrote:
> if of_find_device_by_node() succeed, tegra_emc_probe() doesn't have a
> corresponding put_device(). Thus add jump target to fix the exception
> handling for this function implementation.

Please fix the title in subject and reword, it's not possible to
understand it. You are fixing here error paths, so for example:

"The reference to device obtained with of_find_device_by_node() should
be dropped. Add missing put_device() calls in probe error paths.

> 
> Fixes: 73a7f0a90641("memory: tegra: Add EMC (external memory controller) driver")
> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
> ---
>  drivers/memory/tegra/tegra124-emc.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/tegra124-emc.c
> index 76ace42a688a..831dfca0804c 100644
> --- a/drivers/memory/tegra/tegra124-emc.c
> +++ b/drivers/memory/tegra/tegra124-emc.c
> @@ -1207,8 +1207,10 @@ static int tegra_emc_probe(struct platform_device *pdev)
>  		return -ENOENT;
>  
>  	emc->mc = platform_get_drvdata(mc);
> -	if (!emc->mc)
> -		return -EPROBE_DEFER;
> +	if (!emc->mc) {
> +		err = -EPROBE_DEFER;
> +		goto put_device;
> +	}
>  
>  	ram_code = tegra_read_ram_code();
>  
> @@ -1217,25 +1219,27 @@ static int tegra_emc_probe(struct platform_device *pdev)
>  		dev_err(&pdev->dev,
>  			"no memory timings for RAM code %u found in DT\n",
>  			ram_code);
> -		return -ENOENT;
> +		err = -ENOENT;
> +		goto put_device;
>  	}
>  
>  	err = tegra_emc_load_timings_from_dt(emc, np);
>  	of_node_put(np);
>  	if (err)
> -		return err;
> +		goto put_device;
>  
>  	if (emc->num_timings == 0) {
>  		dev_err(&pdev->dev,
>  			"no memory timings for RAM code %u registered\n",
>  			ram_code);
> -		return -ENOENT;
> +		err = -ENOENT;
> +		goto put_device;
>  	}
>  
>  	err = emc_init(emc);
>  	if (err) {
>  		dev_err(&pdev->dev, "EMC initialization failed: %d\n", err);
> -		return err;
> +		goto put_device;
>  	}
>  
>  	platform_set_drvdata(pdev, emc);
> @@ -1244,6 +1248,9 @@ static int tegra_emc_probe(struct platform_device *pdev)
>  		emc_debugfs_init(&pdev->dev, emc);
>  
>  	return 0;

Line break

> +put_device:
> +	put_device(&mc->dev);

Line break

Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ