All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Huang <mlhuang@CS.Princeton.EDU>
To: Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@lists.netfilter.org
Subject: Re: [PATCH] Fix ipt_ULOG panics on SMP kernels
Date: Fri, 11 Aug 2006 12:45:31 -0400	[thread overview]
Message-ID: <44DCB42B.7010009@cs.princeton.edu> (raw)
In-Reply-To: <44DCAE2E.8040006@trash.net>

[-- Attachment #1: Type: text/plain, Size: 220 bytes --]

Patrick McHardy wrote:
> If you could add a similar fix to
> net/bridge/netfilter/ebt_ulog.c and net/netfilter/nfnetlink_log.c
> and send me a Signed-off-by: line I'll push it in 2.6.18. Thanks.

Done.

Regards,

--Mark

[-- Attachment #2: ipt_ULOG.patch --]
[-- Type: text/x-patch, Size: 2558 bytes --]

Fix kernel panic on various SMP machines. The culprit is a null
ub->skb in ulog_send(). If ulog_timer() has already been scheduled on
one CPU and is spinning on the lock, and ipt_ulog_packet() flushes the
queue on another CPU by calling ulog_send() right before it exits,
there will be no skbuff when ulog_timer() acquires the lock and calls
ulog_send(). Cancelling the timer in ulog_send() doesn't help because
it has already been scheduled and is running on the first CPU.

Similar problem exists in ebt_ulog.c and nfnetlink_log.c.

Signed-off-by: Mark Huang <mlhuang@cs.princeton.edu>

Index: linux-2.6/net/ipv4/netfilter/ipt_ULOG.c
===================================================================
RCS file: /cvs/linux-2.6/net/ipv4/netfilter/ipt_ULOG.c,v
retrieving revision 1.1.3.6
retrieving revision 1.7
diff -u -r1.1.3.6 -r1.7
--- linux-2.6/net/ipv4/netfilter/ipt_ULOG.c	27 Jul 2006 20:49:21 -0000	1.1.3.6
+++ linux-2.6/net/ipv4/netfilter/ipt_ULOG.c	10 Aug 2006 17:50:14 -0000	1.7
@@ -120,6 +120,11 @@
 	if (ub->qlen > 1)
 		ub->lastnlh->nlmsg_type = NLMSG_DONE;
 
+	if (!ub->skb) {
+		DEBUGP("ipt_ULOG: ulog_send: nothing to send\n");
+		return;
+	}
+
 	NETLINK_CB(ub->skb).dst_group = nlgroupnum + 1;
 	DEBUGP("ipt_ULOG: throwing %d packets to netlink group %u\n",
 		ub->qlen, nlgroupnum + 1);
Index: linux-2.6/net/bridge/netfilter/ebt_ulog.c
===================================================================
RCS file: /cvs/linux-2.6/net/bridge/netfilter/ebt_ulog.c,v
retrieving revision 1.1.3.2
diff -u -r1.1.3.2 ebt_ulog.c
--- linux-2.6/net/bridge/netfilter/ebt_ulog.c	27 Jul 2006 20:49:20 -0000	1.1.3.2
+++ linux-2.6/net/bridge/netfilter/ebt_ulog.c	11 Aug 2006 16:40:16 -0000
@@ -79,6 +79,9 @@
 	if (ub->qlen > 1)
 		ub->lastnlh->nlmsg_type = NLMSG_DONE;
 
+	if (!ub->skb)
+		return;
+
 	NETLINK_CB(ub->skb).dst_group = nlgroup + 1;
 	netlink_broadcast(ebtulognl, ub->skb, 0, nlgroup + 1, GFP_ATOMIC);
 
Index: linux-2.6/net/netfilter/nfnetlink_log.c
===================================================================
RCS file: /cvs/linux-2.6/net/netfilter/nfnetlink_log.c,v
retrieving revision 1.1.3.1
diff -u -r1.1.3.1 nfnetlink_log.c
--- linux-2.6/net/netfilter/nfnetlink_log.c	27 Jul 2006 20:49:21 -0000	1.1.3.1
+++ linux-2.6/net/netfilter/nfnetlink_log.c	11 Aug 2006 16:40:16 -0000
@@ -369,6 +369,9 @@
 	if (inst->qlen > 1)
 		inst->lastnlh->nlmsg_type = NLMSG_DONE;
 
+	if (!inst->skb)
+		return 0;
+
 	status = nfnetlink_unicast(inst->skb, inst->peer_pid, MSG_DONTWAIT);
 	if (status < 0) {
 		UDEBUG("netlink_unicast() failed\n");

  reply	other threads:[~2006-08-11 16:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-10 16:31 [PATCH] Fix ipt_ULOG panics on SMP kernels Mark Huang
2006-08-11 16:19 ` Patrick McHardy
2006-08-11 16:45   ` Mark Huang [this message]
2006-08-11 17:13     ` Patrick McHardy

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=44DCB42B.7010009@cs.princeton.edu \
    --to=mlhuang@cs.princeton.edu \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@lists.netfilter.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.