]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ulog: fix panic on SMP kernels
authorMark Huang <mlhuang@cs.princeton.edu>
Sat, 26 Aug 2006 15:35:49 +0000 (17:35 +0200)
committerAdrian Bunk <bunk@stusta.de>
Sat, 26 Aug 2006 15:35:49 +0000 (17:35 +0200)
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: Adrian Bunk <bunk@stusta.de>
net/bridge/netfilter/ebt_ulog.c
net/ipv4/netfilter/ipt_ULOG.c
net/netfilter/nfnetlink_log.c

index 802baf755ef465c392b757642999c3e40b20e2d4..664808c89377bb8a9628d9a906d5ce16d178d088 100644 (file)
@@ -75,6 +75,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 180a9ea57b69fb4e05a7c8b171f1bc1628ae6f8c..8b1e4bc07123d1e98f7cf18b2a966754210caa9b 100644 (file)
@@ -116,6 +116,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 3b3c781b40c067f62b19f47744297c4a6cd747f9..47c1a8f702c5db1c4d8d2a617e092f4f214ec63c 100644 (file)
@@ -349,6 +349,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;