From: Jarek Poplawski <jarkao2@o2.pl>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Wessel\, Jason" <jason.wessel@windriver.com>,
Folkert van Heusden <folkert@vanheusden.com>,
linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
stable@kernel.org, netdev@vger.kernel.org
Subject: [PATCH] Re: [2.6.21.1] soft lockup when removing netconsole module
Date: Wed, 27 Jun 2007 09:24:15 +0200 [thread overview]
Message-ID: <20070627072415.GA1899@ff.dom.local> (raw)
In-Reply-To: <20070626180000.5974e942.akpm@linux-foundation.org>
On Tue, Jun 26, 2007 at 06:00:00PM -0700, Andrew Morton wrote:
> On Tue, 26 Jun 2007 17:46:13 -0700 "Wessel, Jason" <jason.wessel@windriver.com> wrote:
...
> > > Everything went quiet?
> > >
> > > If this patch has been tested and fixes the bug, can you
> > > please send a version which is ready for merging? (ie: add a
> > > suitable description of what it does).
> > >
> > >
> >
> > I mailed Jarek separately.
> >
> > I had tested the patch with netconsole and kgdb and it does in fact fix
> > the problem that was reported.
>
> OK, thanks. Please don't mail people separately!
>
> I queued this up with a null changelog for now.
>
I pasted here this queued version - only the changelog is added.
Regards,
Jarek P.
------------------------------------------------------
Subject: netconsole: fix soft lockup (2.6.21) and memory leak when removing module
From: Jarek Poplawski <jarkao2@o2.pl>
#1
Until kernel ver. 2.6.21 (including) cancel_rearming_delayed_work()
required a work function should always (unconditionally) rearm with
delay > 0 - otherwise it would endlessly loop. This patch replaces
this function with cancel_delayed_work(). Later kernel versions don't
require this, so here it's only for uniformity.
#2
After deleting a timer in cancel_[rearming_]delayed_work() there could
stay a last skb queued in npinfo->txq causing a memory leak after
kfree(npinfo).
Initial patch & testing by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Jarek Poplawski <jarkao2@o2.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
net/core/netpoll.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff -puN net/core/netpoll.c~netconsole-fix-soft-lockup-when-removing-module net/core/netpoll.c
--- a/net/core/netpoll.c~netconsole-fix-soft-lockup-when-removing-module
+++ a/net/core/netpoll.c
@@ -72,7 +72,8 @@ static void queue_process(struct work_st
netif_tx_unlock(dev);
local_irq_restore(flags);
- schedule_delayed_work(&npinfo->tx_work, HZ/10);
+ if (atomic_read(&npinfo->refcnt))
+ schedule_delayed_work(&npinfo->tx_work, HZ/10);
return;
}
netif_tx_unlock(dev);
@@ -785,9 +786,15 @@ 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);
+ cancel_delayed_work(&npinfo->tx_work);
flush_scheduled_work();
+ /* clean after last, unfinished work */
+ if (!skb_queue_empty(&npinfo->txq)) {
+ struct sk_buff *skb;
+ skb = __skb_dequeue(&npinfo->txq);
+ kfree_skb(skb);
+ }
kfree(npinfo);
}
}
prev parent reply other threads:[~2007-06-27 7:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-26 15:40 [2.6.21.1] soft lockup when removing netconsole module Folkert van Heusden
2007-05-26 15:53 ` Parag Warudkar
2007-05-26 16:12 ` Thomas Gleixner
2007-05-26 16:17 ` Folkert van Heusden
2007-05-26 16:35 ` Thomas Gleixner
2007-05-26 16:49 ` Folkert van Heusden
2007-05-26 17:06 ` Thomas Gleixner
2007-05-26 17:12 ` Folkert van Heusden
2007-05-27 20:32 ` Matt Mackall
2007-05-29 7:56 ` Andrew Morton
2007-05-30 13:28 ` [PATCH] " Jason Wessel
2007-05-30 20:38 ` Folkert van Heusden
2007-06-12 11:02 ` Jarek Poplawski
2007-06-13 9:25 ` [PATCH] " Jarek Poplawski
2007-06-26 23:07 ` Andrew Morton
2007-06-27 0:46 ` Wessel, Jason
2007-06-27 1:00 ` Andrew Morton
2007-06-27 7:24 ` Jarek Poplawski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070627072415.GA1899@ff.dom.local \
--to=jarkao2@o2.pl \
--cc=akpm@linux-foundation.org \
--cc=folkert@vanheusden.com \
--cc=jason.wessel@windriver.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stable@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).