From: Florian Westphal <fw@strlen•de>
To: Houcheng Lin <houcheng@gmail•com>
Cc: pablo@netfilter•org, Patrick McHardy <kaber@trash•net>,
kadlec@blackhole•kfki.hu, davem@davemloft•net,
netfilter-devel@vger•kernel.org, Florian Westphal <fw@strlen•de>,
coreteam@netfilter•org, netdev@vger•kernel.org,
Linux Kernel Mailing List <linux-kernel@vger•kernel.org>
Subject: Re: [PATCH v2] netfilter: release skbuf when nlmsg put fail
Date: Tue, 14 Oct 2014 12:49:23 +0200 [thread overview]
Message-ID: <20141014104923.GA30916@breakpoint.cc> (raw)
In-Reply-To: <CAL8JtxD=Vopo7fvKEnfKgOa3T=WyVH=mb_YqX9mES+n-6dJbrQ@mail.gmail.com>
Houcheng Lin <houcheng@gmail•com> wrote:
> When system is under heavy loading, the __nfulnl_send() may may failed
> to put nlmsg into skbuf of nfulnl_instance. If not clear the skbuff on failed,
> the __nfulnl_send() will still try to put next nlmsg onto this half-full skbuf
> and cause the user program can never receive packet.
>
> This patch fix this issue by releasing skbuf immediately after nlmst put
> failed.
Could you please try this patch on top of this one and see if the
WARN_ON goes away?
Thanks
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -649,7 +649,8 @@ nfulnl_log_packet(struct net *net,
+ nla_total_size(sizeof(u_int32_t)) /* gid */
+ nla_total_size(plen) /* prefix */
+ nla_total_size(sizeof(struct nfulnl_msg_packet_hw))
- + nla_total_size(sizeof(struct nfulnl_msg_packet_timestamp));
+ + nla_total_size(sizeof(struct nfulnl_msg_packet_timestamp))
+ + nla_total_size(sizeof(struct nfgenmsg)); /* NLMSG_DONE */
if (in && skb_mac_header_was_set(skb)) {
size += nla_total_size(skb->dev->hard_header_len)
@@ -692,8 +693,7 @@ nfulnl_log_packet(struct net *net,
goto unlock_and_release;
}
- if (inst->skb &&
- size > skb_tailroom(inst->skb) - sizeof(struct nfgenmsg)) {
+ if (inst->skb && size > skb_tailroom(inst->skb)) {
/* either the queue len is too high or we don't have
* enough room in the skb left. flush to userspace. */
__nfulnl_flush(inst);
next prev parent reply other threads:[~2014-10-14 10:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-14 9:42 [PATCH v2] netfilter: release skbuf when nlmsg put fail Houcheng Lin
2014-10-14 10:49 ` Florian Westphal [this message]
2014-10-14 14:51 ` Houcheng Lin
2014-10-14 17:27 ` Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141014104923.GA30916@breakpoint.cc \
--to=fw@strlen$(echo .)de \
--cc=coreteam@netfilter$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=houcheng@gmail$(echo .)com \
--cc=kaber@trash$(echo .)net \
--cc=kadlec@blackhole$(echo .)kfki.hu \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=netfilter-devel@vger$(echo .)kernel.org \
--cc=pablo@netfilter$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox