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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2024122926-size-playset-70c0@gregkh>
Date: Sun, 29 Dec 2024 11:29:03 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Nihar Chaithanya <niharchaithanya@...il.com>
Cc: dpenkler@...il.com, dan.carpenter@...aro.org, skhan@...uxfoundation.org,
	linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 02/15] staging: gpib: agilent_82350b: Handle
 gpib_register_driver() errors

On Sat, Dec 28, 2024 at 11:37:50AM +0530, Nihar Chaithanya wrote:
> The function gpib_register_driver() can fail which can result in
> semi-registered module.
> 
> In case gpib_register_driver() fails unregister the previous
> gpib and pci registering functions, return the error value.
> 
> Signed-off-by: Nihar Chaithanya <niharchaithanya@...il.com>
> ---
>  .../gpib/agilent_82350b/agilent_82350b.c      | 21 ++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/gpib/agilent_82350b/agilent_82350b.c b/drivers/staging/gpib/agilent_82350b/agilent_82350b.c
> index 53006d0cc79c..6f077ede86a6 100644
> --- a/drivers/staging/gpib/agilent_82350b/agilent_82350b.c
> +++ b/drivers/staging/gpib/agilent_82350b/agilent_82350b.c
> @@ -910,13 +910,28 @@ static int __init agilent_82350b_init_module(void)
>  
>  	result = pci_register_driver(&agilent_82350b_pci_driver);
>  	if (result) {
> -		pr_err("agilent_82350b: pci_driver_register failed!\n");
> +		pr_err("agilent_82350b: pci_driver_register failed: error = %d\n", result);
>  		return result;
>  	}
>  
> -	gpib_register_driver(&agilent_82350b_unaccel_interface, THIS_MODULE);
> -	gpib_register_driver(&agilent_82350b_interface, THIS_MODULE);
> +	result = gpib_register_driver(&agilent_82350b_unaccel_interface, THIS_MODULE);
> +	if (result)
> +		goto err_unaccel;
> +
> +	result = gpib_register_driver(&agilent_82350b_interface, THIS_MODULE);
> +	if (result)
> +		goto err_interface;
> +
> +	pr_info("agilent_82350b: module init is complete\n");

Why are you adding noise to drivers like this?  When drivers work
properly, they are quiet.


>  	return 0;
> +
> +err_interface:
> +	gpib_unregister_driver(&agilent_82350b_unaccel_interface);
> +err_unaccel:
> +	pci_unregister_driver(&agilent_82350b_pci_driver);
> +
> +	pr_err("agilent_82350b: gpib_register_driver failed!\n");

No error number here?

Same for all the other changes in this series.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ