mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Florian Westphal <fw@strlen.de>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@openvz.org, Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Subject: [PATCH 1/4] netfilter: nfnetlink_log: use proper helper for fetching physinif
Date: Wed, 10 Jan 2024 19:00:11 +0800	[thread overview]
Message-ID: <20240110110451.5473-2-ptikhomirov@virtuozzo.com> (raw)
In-Reply-To: <20240110110451.5473-1-ptikhomirov@virtuozzo.com>

We don't use physindev in __build_packet_message except for getting
physinif from it. So let's switch to nf_bridge_get_physinif to get what
we want directly.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 net/netfilter/nfnetlink_log.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index f03f4d4d7d889..134e05d31061e 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -508,7 +508,7 @@ __build_packet_message(struct nfnl_log_net *log,
 					 htonl(br_port_get_rcu(indev)->br->dev->ifindex)))
 				goto nla_put_failure;
 		} else {
-			struct net_device *physindev;
+			int physinif;
 
 			/* Case 2: indev is bridge group, we need to look for
 			 * physical device (when called from ipv4) */
@@ -516,10 +516,10 @@ __build_packet_message(struct nfnl_log_net *log,
 					 htonl(indev->ifindex)))
 				goto nla_put_failure;
 
-			physindev = nf_bridge_get_physindev(skb);
-			if (physindev &&
+			physinif = nf_bridge_get_physinif(skb);
+			if (physinif &&
 			    nla_put_be32(inst->skb, NFULA_IFINDEX_PHYSINDEV,
-					 htonl(physindev->ifindex)))
+					 htonl(physinif)))
 				goto nla_put_failure;
 		}
 #endif
-- 
2.43.0


  reply	other threads:[~2024-01-10 11:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10 11:00 [PATCH 0/4] netlink: bridge: fix nf_bridge->physindev use after free Pavel Tikhomirov
2024-01-10 11:00 ` Pavel Tikhomirov [this message]
2024-01-10 13:33   ` [PATCH 1/4] netfilter: nfnetlink_log: use proper helper for fetching physinif Florian Westphal
2024-01-10 13:48     ` Pavel Tikhomirov
2024-01-10 14:01       ` Florian Westphal
2024-01-10 11:00 ` [PATCH 2/4] netfilter: nf_queue: remove excess nf_bridge variable Pavel Tikhomirov
2024-01-10 11:00 ` [PATCH 3/4] netfilter: propagate net to nf_bridge_get_physindev Pavel Tikhomirov
2024-01-10 13:34   ` Florian Westphal
2024-01-10 14:14   ` [PATCH v2 " Pavel Tikhomirov
2024-01-11 14:40     ` Paolo Abeni
2024-01-11 15:10       ` Pavel Tikhomirov
2024-01-10 11:00 ` [PATCH 4/4] netfilter: bridge: replace physindev with physinif in nf_bridge_info Pavel Tikhomirov

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=20240110110451.5473-2-ptikhomirov@virtuozzo.com \
    --to=ptikhomirov@virtuozzo.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=kernel@openvz.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 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®