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: <2548f41a-4910-4b60-9433-87714f594e82@lunn.ch>
Date: Thu, 22 Aug 2024 18:04:47 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Jijie Shao <shaojijie@...wei.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
	pabeni@...hat.com, shenjian15@...wei.com, wangpeiyang1@...wei.com,
	liuyonglong@...wei.com, sudongming1@...wei.com,
	xujunsheng@...wei.com, shiyongbang@...wei.com, libaihan@...wei.com,
	jdamato@...tly.com, horms@...nel.org, jonathan.cameron@...wei.com,
	shameerali.kolothum.thodi@...wei.com, salil.mehta@...wei.com,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V3 net-next 02/11] net: hibmcge: Add read/write registers
 supported through the bar space

>  static int hbg_pci_init(struct pci_dev *pdev)
>  {
> @@ -56,10 +62,15 @@ static int hbg_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	if (ret)
>  		return ret;
>  
> +	ret = hbg_init(priv);
> +	if (ret)
> +		return ret;
> +
>  	ret = devm_register_netdev(dev, netdev);
>  	if (ret)
>  		return dev_err_probe(dev, ret, "failed to register netdev\n");
>  
> +	set_bit(HBG_NIC_STATE_INITED, &priv->state);

There is a potential race here. Before devm_register_netdev() even
returns, the linux stack could be sending packets. You need to ensure
nothing actual needs HBG_NIC_STATE_INITED when the interface is
operating, because it might not be set yet.

In general, such state variables are not needed. If registration
failed, probe failed, and the driver will be unloaded. If registration
succeeded and other functions are being used, registration must of
been successful.

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ