From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Harsh Modi <harshmodi@google.com>
Cc: netfilter-devel@vger.kernel.org, sdf@google.com,
kadlec@netfilter.org, fw@strlen.de
Subject: Re: [PATCH] br_netfilter: Drop dst references before setting.
Date: Wed, 24 Aug 2022 08:11:47 +0200 [thread overview]
Message-ID: <YwXBIz3RyZvshuXi@salvia> (raw)
In-Reply-To: <20220823023814.1666916-1-harshmodi@google.com>
Hi,
On Mon, Aug 22, 2022 at 07:38:14PM -0700, Harsh Modi wrote:
> It is possible that there is already a dst allocated.
This is bridge path, do you know what might have already set up the
dst to the skbuff? Is this a theoretical issue or you are observing a
dst leak there?
> If it is not released, it will be leaked. This is similar to what is
> done in bpf_set_tunnel_key().
>
> Signed-off-by: Harsh Modi <harshmodi@google.com>
> ---
> net/bridge/br_netfilter_hooks.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c
> index ff4779036649..f20f4373ff40 100644
> --- a/net/bridge/br_netfilter_hooks.c
> +++ b/net/bridge/br_netfilter_hooks.c
> @@ -384,6 +384,7 @@ static int br_nf_pre_routing_finish(struct net *net, struct sock *sk, struct sk_
> /* - Bridged-and-DNAT'ed traffic doesn't
> * require ip_forwarding. */
> if (rt->dst.dev == dev) {
> + skb_dst_drop(skb);
> skb_dst_set(skb, &rt->dst);
> goto bridged_dnat;
> }
> @@ -413,6 +414,7 @@ static int br_nf_pre_routing_finish(struct net *net, struct sock *sk, struct sk_
> kfree_skb(skb);
> return 0;
> }
> + skb_dst_drop(skb);
> skb_dst_set_noref(skb, &rt->dst);
> }
>
> --
> 2.37.1.595.g718a3a8f04-goog
>
next prev parent reply other threads:[~2022-08-24 6:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 2:38 [PATCH] br_netfilter: Drop dst references before setting Harsh Modi
2022-08-24 6:11 ` Pablo Neira Ayuso [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-08-19 18:34 Harsh Modi
2022-08-23 1:56 ` Jakub Kicinski
2022-08-23 2:35 ` Harsh Modi
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=YwXBIz3RyZvshuXi@salvia \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=harshmodi@google.com \
--cc=kadlec@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=sdf@google.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.