Commit 49cc5038 authored by Pavel Tikhomirov's avatar Pavel Tikhomirov Committed by Zhengchao Shao
Browse files

netfilter: nfnetlink_log: use proper helper for fetching physinif

mainline inclusion
from mainline-v6.8-rc1
commit c3f9fd54cd87233f53bdf0e191a86b3a5e960e02
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9Q9CH
CVE: CVE-2024-35839

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c3f9fd54cd87233f53bdf0e191a86b3a5e960e02



--------------------------------

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: default avatarPavel Tikhomirov <ptikhomirov@virtuozzo.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
parent ebe8b9e4
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -493,7 +493,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) */
@@ -501,10 +501,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