ip: fib_rules: Fetch net from fib_rule in fib[46]_rule_configure().

JIRA: https://issues.redhat.com/browse/RHEL-150155
Upstream Status: linux.git

commit 5a1ccffd30a08f5a2428cd5fbb3ab03e8eb6c66d
Author: Kuniyuki Iwashima <kuniyu@amazon.com>
Date:   Fri Feb 7 16:24:58 2025 +0900

    ip: fib_rules: Fetch net from fib_rule in fib[46]_rule_configure().

    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 <kuniyu@amazon.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Reviewed-by: Ido Schimmel <idosch@nvidia.com>
    Tested-by: Ido Schimmel <idosch@nvidia.com>
    Link: https://patch.msgid.link/20250207072502.87775-5-kuniyu@amazon.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Antoine Tenart <atenart@redhat.com>
This commit is contained in:
Antoine Tenart
2026-02-18 09:55:35 +01:00
parent 7c471a19d4
commit 3681d436dd
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -245,9 +245,9 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
struct nlattr **tb, struct nlattr **tb,
struct netlink_ext_ack *extack) 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; int err = -EINVAL;
struct fib4_rule *rule4 = (struct fib4_rule *) rule;
if (!inet_validate_dscp(frh->tos)) { if (!inet_validate_dscp(frh->tos)) {
NL_SET_ERR_MSG(extack, NL_SET_ERR_MSG(extack,
+2 -2
View File
@@ -365,9 +365,9 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
struct nlattr **tb, struct nlattr **tb,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
struct fib6_rule *rule6 = (struct fib6_rule *)rule;
struct net *net = rule->fr_net;
int err = -EINVAL; int err = -EINVAL;
struct net *net = sock_net(skb->sk);
struct fib6_rule *rule6 = (struct fib6_rule *) rule;
if (!inet_validate_dscp(frh->tos)) { if (!inet_validate_dscp(frh->tos)) {
NL_SET_ERR_MSG(extack, NL_SET_ERR_MSG(extack,