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: <YiOEWOID23zxaSod@lunn.ch>
Date:   Sat, 5 Mar 2022 16:40:08 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     Zheyu Ma <zheyuma97@...il.com>
Cc:     rajur@...lsio.com, davem@...emloft.net, kuba@...nel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: cxgb3: Fix an error code when probing the driver

On Sat, Mar 05, 2022 at 02:24:44PM +0000, Zheyu Ma wrote:
> During the process of driver probing, probe function should return < 0
> for failure, otherwise kernel will treat value >= 0 as success.
> 
> Therefore, the driver should set 'err' to -EINVAL when
> 'adapter->registered_device_map' is NULL. Otherwise kernel will assume
> that the driver has been successfully probed and will cause unexpected
> errors.
> 
> Signed-off-by: Zheyu Ma <zheyuma97@...il.com>
> ---
>  drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
> index bfffcaeee624..662af61fc723 100644
> --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
> +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
> @@ -3346,6 +3346,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	}
>  	if (!adapter->registered_device_map) {
>  		dev_err(&pdev->dev, "could not register any net devices\n");
> +		err = -EINVAL;

ENODEV would be better.

       Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ