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>] [day] [month] [year] [list]
Message-ID: <1389039879.9947.104.camel@bwh-desktop.uk.level5networks.com>
Date:	Mon, 6 Jan 2014 20:24:39 +0000
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	<jiang.biao2@....com.cn>
CC:	David Miller <davem@...emloft.net>, <li.fengmao@....com.cn>,
	<manish.chopra@...gic.com>, <netdev@...r.kernel.org>,
	<rajesh.borundia@...gic.com>, <sony.chacko@...gic.com>,
	<wang.liang82@....com.cn>, <cai.qu@....com.cn>,
	<long.chun@....com.cn>
Subject: Re: 答复: Re: [Patch] netxen_nic:
 Bugfix for wrong RUNNING status of NX3031 NICs with no link

On Fri, 2014-01-03 at 15:07 +0800, jiang.biao2@....com.cn wrote:
> >>> You cannot do this, because at the very exact moment you call
> >>> register_netdevice() the device can be brought up and once the
> >>> device is up the link can be brought up.
> 
> >>> Therefore if you invoke netif_carrier_off() right after
> >>> register_netdevice(), it can cancel out a legitimate
> >>> netif_carrier_on() call.
> 
> >> register_netdevice() should be call in probe(), at that time, is
> >> it impossible to bring up device because the driver loading has
> >> not finished?
> 
> > So far as the networking core is concerned, when register_netdevice() is
> > called the device is ready to use.  But you can do:
> 
> > rtnl_lock();
> > register_netdevice();
> > netif_carrier_off();
> > rtnl_unlock();
> 
> > However, as I said before, the current order in netxen_nic works and
> > only older kernel versions require you to call netif_carrier_off() after
> > registering the device.
> 
> >> Even that, the netif_carrier_off() will be called before
> >> netif_carrier_on(), and that will not be a problem.
> 
> >> Besides, the other net drivers(e.g igb, e1000, e1000e) I saw all
> >> call netif_carrier_off() after register_netdev(). There is no such
> >> problems in these drivers.
> 
> > It is not easy to hit the race condition but it is real.
> 
> But the problem I depicted really exists in the current netxen_nic driver,
> you can easily reproduce it following the reproduction steps.

'Current' as in Linux 3.12/3.13-rc7?

I don't know where I would find a Netxen card now.  So I can't test
netxen_nic myself, but I can assure you the sfc driver does things in
the same order and it works correctly.

> Can the following modification fix both the problem I faced and the race
> you worried?
> 
> netif_carrier_off();
> netdev->operstate=IF_OPER_DOWN;
> register_netdevice();

register_netdevice() calls linkwatch_init_dev() which sets the operstate
if necessary.  You should not set it directly.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ