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: <5a93b446-6302-1305-071d-5d25d9f9d0a1@kernel.org>
Date:   Mon, 7 Nov 2022 13:56:52 -0600
From:   Dinh Nguyen <dinguyen@...nel.org>
To:     Yang Yingliang <yangyingliang@...wei.com>,
        linux-kernel@...r.kernel.org, richard.gong@...el.com,
        atull@...nel.org, tien.sung.ang@...el.com
Subject: Re: [PATCH 2/2] firmware: stratix10-svc: fix error handle while
 alloc/add device failed



On 11/3/22 02:09, Yang Yingliang wrote:
> If add device "stratix10-rsu" failed in stratix10_svc_drv_probe(),
> the 'svc_fifo' and 'genpool' need be freed in the error path.
> 
> If allocate or add device "intel-fcs" failed in stratix10_svc_drv_probe(),
> the device "stratix10-rsu" need be unregistered in the error path.
> 
> Fixes: e6281c26674e ("firmware: stratix10-svc: Add support for FCS")
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> ---
>   drivers/firmware/stratix10-svc.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c
> index 1a5640b3ab42..bde1f543f529 100644
> --- a/drivers/firmware/stratix10-svc.c
> +++ b/drivers/firmware/stratix10-svc.c
> @@ -1202,19 +1202,20 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
>   	ret = platform_device_add(svc->stratix10_svc_rsu);
>   	if (ret) {
>   		platform_device_put(svc->stratix10_svc_rsu);
> -		return ret;
> +		goto err_free_kfifo;
>   	}
>   
>   	svc->intel_svc_fcs = platform_device_alloc(INTEL_FCS, 1);
>   	if (!svc->intel_svc_fcs) {
>   		dev_err(dev, "failed to allocate %s device\n", INTEL_FCS);
> -		return -ENOMEM;
> +		ret = -ENOMEM;
> +		goto err_unregister_dev;
>   	}
>   
>   	ret = platform_device_add(svc->intel_svc_fcs);
>   	if (ret) {
>   		platform_device_put(svc->intel_svc_fcs);
> -		return ret;
> +		goto err_unregister_dev;
>   	}
>   
>   	dev_set_drvdata(dev, svc);
> @@ -1223,6 +1224,8 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
>   
>   	return 0;
>   
> +err_unregister_dev:
> +	platform_device_unregister(svc->stratix10_svc_rsu);
>   err_free_kfifo:
>   	kfifo_free(&controller->svc_fifo);
>   err_destroy_pool:

Acked-by: Dinh Nguyen <dinguyen@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ