Commit e3567061 authored by Michal Miroslaw's avatar Michal Miroslaw Committed by David S. Miller

[NETFILTER]: nfnetlink_log: kill duplicate code

Kill some cut'n'paste effect.
Just after __nfulnl_send() returning, inst->skb is always NULL.
Signed-off-by: default avatarMichal Miroslaw <mirq-linux@rere.qmqm.pl>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5faa1f4c
...@@ -188,7 +188,7 @@ out_unlock: ...@@ -188,7 +188,7 @@ out_unlock:
return NULL; return NULL;
} }
static int __nfulnl_send(struct nfulnl_instance *inst); static void __nfulnl_flush(struct nfulnl_instance *inst);
static void static void
__instance_destroy(struct nfulnl_instance *inst) __instance_destroy(struct nfulnl_instance *inst)
...@@ -202,17 +202,8 @@ __instance_destroy(struct nfulnl_instance *inst) ...@@ -202,17 +202,8 @@ __instance_destroy(struct nfulnl_instance *inst)
/* then flush all pending packets from skb */ /* then flush all pending packets from skb */
spin_lock_bh(&inst->lock); spin_lock_bh(&inst->lock);
if (inst->skb) { if (inst->skb)
/* timer "holds" one reference (we have one more) */ __nfulnl_flush(inst);
if (del_timer(&inst->timer))
instance_put(inst);
if (inst->qlen)
__nfulnl_send(inst);
if (inst->skb) {
kfree_skb(inst->skb);
inst->skb = NULL;
}
}
spin_unlock_bh(&inst->lock); spin_unlock_bh(&inst->lock);
/* and finally put the refcount */ /* and finally put the refcount */
...@@ -364,6 +355,16 @@ nlmsg_failure: ...@@ -364,6 +355,16 @@ nlmsg_failure:
return status; return status;
} }
static void
__nfulnl_flush(struct nfulnl_instance *inst)
{
/* timer holds a reference */
if (del_timer(&inst->timer))
instance_put(inst);
if (inst->skb)
__nfulnl_send(inst);
}
static void nfulnl_timer(unsigned long data) static void nfulnl_timer(unsigned long data)
{ {
struct nfulnl_instance *inst = (struct nfulnl_instance *)data; struct nfulnl_instance *inst = (struct nfulnl_instance *)data;
...@@ -650,10 +651,7 @@ nfulnl_log_packet(unsigned int pf, ...@@ -650,10 +651,7 @@ nfulnl_log_packet(unsigned int pf,
* enough room in the skb left. flush to userspace. */ * enough room in the skb left. flush to userspace. */
UDEBUG("flushing old skb\n"); UDEBUG("flushing old skb\n");
/* timer "holds" one reference (we have another one) */ __nfulnl_flush(inst);
if (del_timer(&inst->timer))
instance_put(inst);
__nfulnl_send(inst);
} }
if (!inst->skb) { if (!inst->skb) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment