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]
Date:   Mon, 28 Nov 2022 08:38:23 -0700
From:   Dave Jiang <dave.jiang@...el.com>
To:     Yuan Can <yuancan@...wei.com>, jdmason@...zu.us, allenbh@...il.com,
        davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, nab@...ux-iscsi.org, gregkh@...uxfoundation.org,
        ntb@...ts.linux.dev, netdev@...r.kernel.org
Subject: Re: [PATCH] net: net_netdev: Fix error handling in
 ntb_netdev_init_module()



On 11/24/2022 12:09 AM, Yuan Can wrote:
> The ntb_netdev_init_module() returns the ntb_transport_register_client()
> directly without checking its return value, if
> ntb_transport_register_client() failed, the NTB client device is not
> unregistered.
> 
> Fix by unregister NTB client device when ntb_transport_register_client()
> failed.
> 
> Fixes: 548c237c0a99 ("net: Add support for NTB virtual ethernet device")
> Signed-off-by: Yuan Can <yuancan@...wei.com>

Reviewed-by: Dave Jiang <dave.jiang@...el.com>

> ---
>   drivers/net/ntb_netdev.c | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
> index 464d88ca8ab0..a4abea921046 100644
> --- a/drivers/net/ntb_netdev.c
> +++ b/drivers/net/ntb_netdev.c
> @@ -484,7 +484,14 @@ static int __init ntb_netdev_init_module(void)
>   	rc = ntb_transport_register_client_dev(KBUILD_MODNAME);
>   	if (rc)
>   		return rc;
> -	return ntb_transport_register_client(&ntb_netdev_client);
> +
> +	rc = ntb_transport_register_client(&ntb_netdev_client);
> +	if (rc) {
> +		ntb_transport_unregister_client_dev(KBUILD_MODNAME);
> +		return rc;
> +	}
> +
> +	return 0;
>   }
>   module_init(ntb_netdev_init_module);
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ