From: Xuanqiang Luo <xuanqiang.luo@linux.dev>
To: Wentao Liang <vulab@iscas.ac.cn>
Cc: davem@davemloft.net, edumazet@google.com, fw@strlen.de,
horms@kernel.org, kuba@kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, netfilter-devel@vger.kernel.org,
pabeni@redhat.com, pablo@netfilter.org, phil@nwl.cc,
wenxu@ucloud.cn, stable@vger.kernel.org, coreteam@netfilter.org
Subject: Re: [PATCH] netfilter: nf_dup_netdev: Fix net_device reference leak in nft_fwd_dup_netdev_offload()
Date: Wed, 16 Sep 2026 16:41:24 +0800 [thread overview]
Message-ID: <047c05f7-be17-4dc5-8774-db6f9c84ae07@linux.dev> (raw)
In-Reply-To: <20260916073627.1971921-1-vulab@iscas.ac.cn>
在 2026/9/16 15:36, Wentao Liang 写道:
> In nft_fwd_dup_netdev_offload(), dev_get_by_index() gets a reference to
> the net_device corresponding to oif. When nft_flow_action_entry_next()
> fails (returning NULL), the function returns -E2BIG directly without
> dropping the net_device reference via dev_put(), causing a reference
> leak.
>
> Add dev_put(dev) before returning -E2BIG on failure.
>
> Fixes: be2861dc36d7 ("netfilter: nft_{fwd,dup}_netdev: add offload support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> net/netfilter/nf_dup_netdev.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/netfilter/nf_dup_netdev.c b/net/netfilter/nf_dup_netdev.c
> index 3b0a70e154cd..dd627b7d72d9 100644
> --- a/net/netfilter/nf_dup_netdev.c
> +++ b/net/netfilter/nf_dup_netdev.c
> @@ -80,8 +80,10 @@ int nft_fwd_dup_netdev_offload(struct nft_offload_ctx *ctx,
> return -EOPNOTSUPP;
>
> entry = nft_flow_action_entry_next(ctx, flow);
> - if (!entry)
> + if (!entry) {
> + dev_put(dev);
> return -E2BIG;
> + }
>
> entry->id = id;
> entry->dev = dev;
Please update your local tree.
Florian Westphal has already fixed this issue:
https://lore.kernel.org/all/20260605114715.11297-1-fw@strlen.de/
Thanks!
prev parent reply other threads:[~2026-09-16 8:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 7:36 Wentao Liang
2026-09-16 8:41 ` Xuanqiang Luo [this message]
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=047c05f7-be17-4dc5-8774-db6f9c84ae07@linux.dev \
--to=xuanqiang.luo@linux.dev \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
--cc=stable@vger.kernel.org \
--cc=vulab@iscas.ac.cn \
--cc=wenxu@ucloud.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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
all inboxes | Powered by JetHome®