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]
Message-ID: <1345877374.19483.88.camel@edumazet-glaptop>
Date:	Sat, 25 Aug 2012 08:49:34 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Cong Wang <amwang@...hat.com>
Cc:	netdev@...r.kernel.org,
	Sylvain Munaut <s.munaut@...tever-company.com>,
	David Miller <davem@...emloft.net>
Subject: Re: Q: what protects dev->napi_list?

On Sat, 2012-08-25 at 14:08 +0800, Cong Wang wrote:
> On Fri, 2012-08-24 at 13:29 +0200, Eric Dumazet wrote:
> > On Fri, 2012-08-24 at 18:39 +0800, Cong Wang wrote:
> > > 
> > > Yeah, but bnx2 driver calls it at other time too, for example
> > > bnx2_change_ring_size() which in turn could be called by
> > > bnx2_set_channels().
> > 
> > Then at this point, device is stopped, or should be.
> > 
> 
> But poll_napi() is still iterating the dev->napi_list, could anyone
> stops it?
> 
> IOW, the following race condition may happen:
> 
> static void poll_napi(struct net_device *dev)
> {               
>         struct napi_struct *napi;
>         int budget = 16;
>                 
>         WARN_ON_ONCE(!irqs_disabled());
>                 
>         list_for_each_entry(napi, &dev->napi_list, dev_list) {
>                 local_irq_enable();
> 
> 				//<-- Another process may call
> 				//bnx2_change_ring_size() to del
> 				//napi from dev, on other CPU.
> 
>                 local_irq_disable();
>         }
> }
> 
> 

Are you trying to say netpoll is buggy ?

Thats the first time I ear that !

Just kidding.

I repeat again : If bnx2_change_ring_size() is called while netconsole
is able to enter poll_napi(), then netpoll is buggy and should be fixed.

napi_list is manipulated under a mutex protection, and there is no way
netpoll can use a mutex. Same mutex protection for all other netdevice
management, so even calling start_xmit() should be forbidden in this
state.

Therefore, netpoll must be disabled while a device is reconfigured.


--
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