From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B704B1B81DC; Mon, 2 Jun 2025 14:48:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748875683; cv=none; b=eKEomRSSRQ5i9nVINIOjoAzvgw+LP37E4Mpe1/fF4o6SeSUJF4TaTg1ZIbOn7k/asKWGOQY45fb71gOHZbnv+Ii8j0J0lcjYPknZ347GpF6R45rZDdTxj5KMOPW1ptu2reXFuNSLqBMiuU1iYj/NOPZdewHs18jL1+f6BlowwAE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748875683; c=relaxed/simple; bh=8dlGyb376UFbDzzD24rFbWhJyAqnzY3oaLu44H4mfRg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Gzbc5/52XsXaC5A71bnF0H1PBoxefVtcquCLv4/vbfGX9JrUYmbLO4kM5ktKbdHQ8sEnuYk//ufe2ieInPen0gWnb3/jlsvyizxKZGZ02nET5JnxAlYbRiEgcsQbvc8tRs5r9Ahvifo95JPc2GZZiY00oUii5znfNSynLWlg4JI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yz2SH/YI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="yz2SH/YI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22B0AC4CEEB; Mon, 2 Jun 2025 14:48:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748875683; bh=8dlGyb376UFbDzzD24rFbWhJyAqnzY3oaLu44H4mfRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yz2SH/YI5VsUZch/sljy32JTI1TOQL9DOsh+OqEvt065mp/BFPC//4+4bDrL7ly0l WwiiJraBykSAoz2F5hMNUHCO3VjtbwXk7Kp2TAMAS/xG09Zv10FE/IREQHrCUlw0zP vS6Y6kRNyA0LSc0/wnXCTxs8pT0T+NtgXSQN2DSk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kuniyuki Iwashima , Eric Dumazet , Ido Schimmel , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 211/270] ip: fib_rules: Fetch net from fib_rule in fib[46]_rule_configure(). Date: Mon, 2 Jun 2025 15:48:16 +0200 Message-ID: <20250602134315.810785605@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134307.195171844@linuxfoundation.org> References: <20250602134307.195171844@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kuniyuki Iwashima [ Upstream commit 5a1ccffd30a08f5a2428cd5fbb3ab03e8eb6c66d ] The following patch will not set skb->sk from VRF path. Let's fetch net from fib_rule->fr_net instead of sock_net(skb->sk) in fib[46]_rule_configure(). Signed-off-by: Kuniyuki Iwashima Reviewed-by: Eric Dumazet Reviewed-by: Ido Schimmel Tested-by: Ido Schimmel Link: https://patch.msgid.link/20250207072502.87775-5-kuniyu@amazon.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv4/fib_rules.c | 4 ++-- net/ipv6/fib6_rules.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index d279cb8ac1584..a270951386e19 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c @@ -226,9 +226,9 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb, struct nlattr **tb, struct netlink_ext_ack *extack) { - struct net *net = sock_net(skb->sk); + struct fib4_rule *rule4 = (struct fib4_rule *)rule; + struct net *net = rule->fr_net; int err = -EINVAL; - struct fib4_rule *rule4 = (struct fib4_rule *) rule; if (frh->tos & ~IPTOS_TOS_MASK) { NL_SET_ERR_MSG(extack, "Invalid tos"); diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index cf9a44fb8243d..0d4e82744921f 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c @@ -353,9 +353,9 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb, struct nlattr **tb, struct netlink_ext_ack *extack) { + struct fib6_rule *rule6 = (struct fib6_rule *)rule; + struct net *net = rule->fr_net; int err = -EINVAL; - struct net *net = sock_net(skb->sk); - struct fib6_rule *rule6 = (struct fib6_rule *) rule; if (rule->action == FR_ACT_TO_TBL && !rule->l3mdev) { if (rule->table == RT6_TABLE_UNSPEC) { -- 2.39.5