diff options
-rw-r--r-- | net/netfilter/nfnetlink_log.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 512741afca9f..0fa17421bbc6 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -644,9 +644,8 @@ nfulnl_log_packet(unsigned int pf, | |||
644 | goto unlock_and_release; | 644 | goto unlock_and_release; |
645 | } | 645 | } |
646 | 646 | ||
647 | if (inst->qlen >= qthreshold || | 647 | if (inst->skb && |
648 | (inst->skb && size > | 648 | size > skb_tailroom(inst->skb) - sizeof(struct nfgenmsg)) { |
649 | skb_tailroom(inst->skb) - sizeof(struct nfgenmsg))) { | ||
650 | /* either the queue len is too high or we don't have | 649 | /* either the queue len is too high or we don't have |
651 | * enough room in the skb left. flush to userspace. */ | 650 | * enough room in the skb left. flush to userspace. */ |
652 | UDEBUG("flushing old skb\n"); | 651 | UDEBUG("flushing old skb\n"); |
@@ -666,9 +665,11 @@ nfulnl_log_packet(unsigned int pf, | |||
666 | __build_packet_message(inst, skb, data_len, pf, | 665 | __build_packet_message(inst, skb, data_len, pf, |
667 | hooknum, in, out, li, prefix, plen); | 666 | hooknum, in, out, li, prefix, plen); |
668 | 667 | ||
668 | if (inst->qlen >= qthreshold) | ||
669 | __nfulnl_flush(inst); | ||
669 | /* timer_pending always called within inst->lock, so there | 670 | /* timer_pending always called within inst->lock, so there |
670 | * is no chance of a race here */ | 671 | * is no chance of a race here */ |
671 | if (!timer_pending(&inst->timer)) { | 672 | else if (!timer_pending(&inst->timer)) { |
672 | instance_get(inst); | 673 | instance_get(inst); |
673 | inst->timer.expires = jiffies + (inst->flushtimeout*HZ/100); | 674 | inst->timer.expires = jiffies + (inst->flushtimeout*HZ/100); |
674 | add_timer(&inst->timer); | 675 | add_timer(&inst->timer); |