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: <7559a7fc-b503-43e6-9cdd-60f479398108@linuxfoundation.org>
Date: Thu, 26 Dec 2024 14:10:43 -0700
From: Shuah Khan <skhan@...uxfoundation.org>
To: Nihar Chaithanya <niharchaithanya@...il.com>, dpenkler@...il.com,
 gregkh@...uxfoundation.org
Cc: dan.carpenter@...aro.org, linux-staging@...ts.linux.dev,
 linux-kernel@...r.kernel.org, Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH v4 03/15] staging: gpib: agilent_82357a: Handle
 gpib_register_driver() errors

On 12/26/24 12:36, Nihar Chaithanya wrote:
> The usb_register() function can fail and returns an error value which
> is not returned. The function gpib_register_driver() can also fail
> which can result in semi-registered module.
> 
> In case gpib_register_driver() fails unregister the previous usb driver
> registering function. Return the error value if gpib_register_driver()
> or usb_register() functions fail.
> 
> Signed-off-by: Nihar Chaithanya <niharchaithanya@...il.com>
> ---
>   .../staging/gpib/agilent_82357a/agilent_82357a.c    | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c
> index bf05fb4a736b..60311ce8d164 100644
> --- a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c
> +++ b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c
> @@ -1691,14 +1691,21 @@ static struct usb_driver agilent_82357a_bus_driver = {
>   static int __init agilent_82357a_init_module(void)
>   {
>   	int i;
> +	int ret = 0;
>   
>   	pr_info("agilent_82357a_gpib driver loading");

This message could be moved to the end of the routine saying
module init is complete - also fdor all of these messages,
dev_* might work better.

>   	for (i = 0; i < MAX_NUM_82357A_INTERFACES; ++i)
>   		agilent_82357a_driver_interfaces[i] = NULL;
> -	usb_register(&agilent_82357a_bus_driver);
> -	gpib_register_driver(&agilent_82357a_gpib_interface, THIS_MODULE);
>   
> -	return 0;
> +	ret = usb_register(&agilent_82357a_bus_driver);
> +	if (ret)
> +		return ret;
> +
> +	ret = gpib_register_driver(&agilent_82357a_gpib_interface, THIS_MODULE);
> +	if (ret)
> +		usb_deregister(&agilent_82357a_bus_driver);
> +
> +	return ret;
>   }
>   
>   static void __exit agilent_82357a_exit_module(void)

thanks,
-- Shuah


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ