From: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf] netfilter: nf_queue: hold reference on skb->dev
Date: Wed, 13 May 2026 01:25:32 +0200 [thread overview]
Message-ID: <agO27EBuW7aLbdqu@strlen.de> (raw)
In-Reply-To: <20260512224417.812214-1-pablo@netfilter.org>
Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> Before NF_BR_LOCAL_IN, skb->dev is mangled in a way that results in
> state->in != skb->dev, which can result in UaF when accessing the bridge
> device if removed while in the queue.
>
> Reported-by: Ren Wei <n05ec@lzu.edu.cn>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
> net/netfilter/nf_queue.c | 6 ++++++
> net/netfilter/nfnetlink_queue.c | 3 +++
> 2 files changed, 9 insertions(+)
>
> diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
> index a6c81c04b3a5..9c6741673842 100644
> --- a/net/netfilter/nf_queue.c
> +++ b/net/netfilter/nf_queue.c
> @@ -59,8 +59,11 @@ static void nf_queue_sock_put(struct sock *sk)
> static void nf_queue_entry_release_refs(struct nf_queue_entry *entry)
> {
> struct nf_hook_state *state = &entry->state;
> + struct sk_buff *skb = entry->skb;
>
> /* Release those devices we held, or Alexey will kill me. */
> + if (skb->dev)
> + dev_put(skb->dev);
dev_hold/put(NULL) is safe, no need for NULL guard (and no need
to resend).
Thanks for making a patch. I'll make a patch for the pptp/gre bug in
case reporter remains silent.
prev parent reply other threads:[~2026-05-12 23:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 22:44 [PATCH nf] netfilter: nf_queue: hold reference on skb->dev Pablo Neira Ayuso
2026-05-12 23:25 ` Florian Westphal [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=agO27EBuW7aLbdqu@strlen.de \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/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