]> err.no Git - linux-2.6/commitdiff
[NETFILTER]: ulog: fix panic on SMP kernels
authorMark Huang <mlhuang@cs.princeton.edu>
Mon, 14 Aug 2006 01:57:54 +0000 (18:57 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Aug 2006 01:57:54 +0000 (18:57 -0700)
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>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/netfilter/ebt_ulog.c
net/ipv4/netfilter/ipt_ULOG.c
net/netfilter/nfnetlink_log.c

index 02693a230dc1faae5d3252f62c4f9a2334ea3f00..9f950db3b76f5135cbb7e1ca7aca9022e5fbcc30 100644 (file)
@@ -74,6 +74,9 @@ static void ulog_send(unsigned int nlgroup)
        if (timer_pending(&ub->timer))
                del_timer(&ub->timer);
 
+       if (!ub->skb)
+               return;
+
        /* last nlmsg needs NLMSG_DONE */
        if (ub->qlen > 1)
                ub->lastnlh->nlmsg_type = NLMSG_DONE;
index d7dd7fe7051ca4413de76da6e631403499b67925..d46fd677fa11f8f48f30e136d843cb95f3ae8c45 100644 (file)
@@ -115,6 +115,11 @@ static void ulog_send(unsigned int nlgroupnum)
                del_timer(&ub->timer);
        }
 
+       if (!ub->skb) {
+               DEBUGP("ipt_ULOG: ulog_send: nothing to send\n");
+               return;
+       }
+
        /* last nlmsg needs NLMSG_DONE */
        if (ub->qlen > 1)
                ub->lastnlh->nlmsg_type = NLMSG_DONE;
index 61cdda4e5d3ba8b25f02af19a7bbb634fc9a0d84..b59d3b2bde21815ad8c20f8fe758c226eff566f4 100644 (file)
@@ -366,6 +366,9 @@ __nfulnl_send(struct nfulnl_instance *inst)
        if (timer_pending(&inst->timer))
                del_timer(&inst->timer);
 
+       if (!inst->skb)
+               return 0;
+
        if (inst->qlen > 1)
                inst->lastnlh->nlmsg_type = NLMSG_DONE;