aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/netfilter/nfnetlink_log.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index a90a26bd618b..512741afca9f 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -188,7 +188,7 @@ out_unlock:
188 return NULL; 188 return NULL;
189} 189}
190 190
191static int __nfulnl_send(struct nfulnl_instance *inst); 191static void __nfulnl_flush(struct nfulnl_instance *inst);
192 192
193static void 193static void
194__instance_destroy(struct nfulnl_instance *inst) 194__instance_destroy(struct nfulnl_instance *inst)
@@ -202,17 +202,8 @@ __instance_destroy(struct nfulnl_instance *inst)
202 /* then flush all pending packets from skb */ 202 /* then flush all pending packets from skb */
203 203
204 spin_lock_bh(&inst->lock); 204 spin_lock_bh(&inst->lock);
205 if (inst->skb) { 205 if (inst->skb)
206 /* timer "holds" one reference (we have one more) */ 206 __nfulnl_flush(inst);
207 if (del_timer(&inst->timer))
208 instance_put(inst);
209 if (inst->qlen)
210 __nfulnl_send(inst);
211 if (inst->skb) {
212 kfree_skb(inst->skb);
213 inst->skb = NULL;
214 }
215 }
216 spin_unlock_bh(&inst->lock); 207 spin_unlock_bh(&inst->lock);
217 208
218 /* and finally put the refcount */ 209 /* and finally put the refcount */
@@ -364,6 +355,16 @@ nlmsg_failure:
364 return status; 355 return status;
365} 356}
366 357
358static void
359__nfulnl_flush(struct nfulnl_instance *inst)
360{
361 /* timer holds a reference */
362 if (del_timer(&inst->timer))
363 instance_put(inst);
364 if (inst->skb)
365 __nfulnl_send(inst);
366}
367
367static void nfulnl_timer(unsigned long data) 368static void nfulnl_timer(unsigned long data)
368{ 369{
369 struct nfulnl_instance *inst = (struct nfulnl_instance *)data; 370 struct nfulnl_instance *inst = (struct nfulnl_instance *)data;
@@ -650,10 +651,7 @@ nfulnl_log_packet(unsigned int pf,
650 * enough room in the skb left. flush to userspace. */ 651 * enough room in the skb left. flush to userspace. */
651 UDEBUG("flushing old skb\n"); 652 UDEBUG("flushing old skb\n");
652 653
653 /* timer "holds" one reference (we have another one) */ 654 __nfulnl_flush(inst);
654 if (del_timer(&inst->timer))
655 instance_put(inst);
656 __nfulnl_send(inst);
657 } 655 }
658 656
659 if (!inst->skb) { 657 if (!inst->skb) {