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]
Date:   Mon, 31 Jan 2022 13:50:06 +0100
From:   Maximilian Luz <luzmaximilian@...il.com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        Hans de Goede <hdegoede@...hat.com>,
        Mark Gross <markgross@...nel.org>,
        Benjamin Tissoires <benjamin.tissoires@...hat.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
        platform-driver-x86@...r.kernel.org
Subject: Re: [PATCH] surface: surface3-wmi: Simplify resource management

On 1/30/22 09:36, Christophe JAILLET wrote:
> 's3_wmi.input' is a managed resource, so there should be no need to free it
> explicitly.
> 
> Moreover, 's3_wmi' is a global variable. 's3_wmi.input' should be NULL
> when this error handling path is executed, because it has not been
> assigned yet.
> 
> All this is puzzling. So simplify it and remove a few lines of code to have
> it be more straightforward.
> 
> Fixes: 3dda3b3798f9 ("platform/x86: Add custom surface3 platform device for controlling LID")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>

Right, that input_free_device(s3_wmi.input) seems wrong. Patch looks
good to me.

Reviewed-by: Maximilian Luz <luzmaximilian@...il.com>

> ---
> Compile tested only
> ---
>   drivers/platform/surface/surface3-wmi.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/platform/surface/surface3-wmi.c b/drivers/platform/surface/surface3-wmi.c
> index 09ac9cfc40d8..b9a4b2d81f4b 100644
> --- a/drivers/platform/surface/surface3-wmi.c
> +++ b/drivers/platform/surface/surface3-wmi.c
> @@ -190,14 +190,11 @@ static int s3_wmi_create_and_register_input(struct platform_device *pdev)
>   
>   	error = input_register_device(input);
>   	if (error)
> -		goto out_err;
> +		return error;
>   
>   	s3_wmi.input = input;
>   
>   	return 0;
> - out_err:
> -	input_free_device(s3_wmi.input);
> -	return error;
>   }
>   
>   static int __init s3_wmi_probe(struct platform_device *pdev)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ