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: <20070530222744.GA347@tv-sign.ru>
Date:	Thu, 31 May 2007 02:27:44 +0400
From:	Oleg Nesterov <oleg@...sign.ru>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Jason Wessel <jason.wessel@...driver.com>,
	Stephen Hemminger <shemminger@...ux-foundation.org>,
	"David S. Miller" <davem@...emloft.net>,
	linux-kernel@...r.kernel.org, Tejun Heo <htejun@...il.com>
Subject: Re: + fix-soft-lockup-when-removing-netconsole-module.patch added to -mm tree

On 05/30, Andrew Morton wrote:
>
> On Thu, 31 May 2007 01:01:37 +0400
> Oleg Nesterov <oleg@...sign.ru> wrote:
> 
> > Jason Wessel wrote:
> > >
> > > The netpoll_cleanup handler can hang the kernel if there is no work in the
> > > work queue because a call to cancel_rearming_delayed_work() with no work
> > > goes into an infinite loop.
> > 
> > This should not be true any longer, cancel_rearming_delayed_work() should work
> > correctly in any case.
> > 
> > Could you please clarify?
> 
> We need a 2.6.21.x fix.

Ah, OK, sorry for noise.

> > > @@ -771,30 +771,32 @@ void netpoll_cleanup(struct netpoll *np)
> > >
> > > [...snip...]
> > >
> > > +		if (atomic_dec_and_test(&npinfo->refcnt)) {
> > > +			skb_queue_purge(&npinfo->arp_tx);
> > > +			skb_queue_purge(&npinfo->txq);
> > > +			if (delayed_work_pending(&npinfo->tx_work)) {
> > >  				cancel_rearming_delayed_work(&npinfo->tx_work);
> > >  				flush_scheduled_work();
> > 
> > But this "if (delayed_work_pending())" is racy anyway?
> > 
> 
> I guess so, a bit.

How about this COMPLETELY UNTESTED patch? (it borrows Tejun's double flush
trick).

--- n/net/core/netpoll.c~	2007-05-31 02:12:37.000000000 +0400
+++ n/net/core/netpoll.c	2007-05-31 02:13:39.000000000 +0400
@@ -773,8 +773,16 @@ void netpoll_cleanup(struct netpoll *np)
 			if (atomic_dec_and_test(&npinfo->refcnt)) {
 				skb_queue_purge(&npinfo->arp_tx);
 				skb_queue_purge(&npinfo->txq);
-				cancel_rearming_delayed_work(&npinfo->tx_work);
+
 				flush_scheduled_work();
+				/*
+				 * the next invocation of queue_process() can't
+				 * re-schedule ->tx_work because ->txq is empty
+				 */
+				if (!cancel_delayed_work(&npinfo->tx_work)) {
+					/* may be queued, wait for completion */
+					flush_scheduled_work();
+				}
 
 				kfree(npinfo);
 			}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ