Skip to content

Commit bd4bcf1

Browse files
CKI Backport BotHangbin Liu
authored andcommitted
ipv6: Use RCU in ip6_input()
JIRA: https://issues.redhat.com/browse/RHEL-115578 commit b768294 Author: Eric Dumazet <edumazet@google.com> Date: Wed Feb 5 15:51:20 2025 +0000 ipv6: Use RCU in ip6_input() Instead of grabbing rcu_read_lock() from ip6_input_finish(), do it earlier in is caller, so that ip6_input() access to dev_net() can be validated by LOCKDEP. Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20250205155120.1676781-13-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com>
1 parent 99db195 commit bd4bcf1

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

net/ipv6/ip6_input.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,19 +477,23 @@ void ip6_protocol_deliver_rcu(struct net *net, struct sk_buff *skb, int nexthdr,
477477
static int ip6_input_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
478478
{
479479
skb_clear_delivery_time(skb);
480-
rcu_read_lock();
481480
ip6_protocol_deliver_rcu(net, skb, 0, false);
482-
rcu_read_unlock();
483481

484482
return 0;
485483
}
486484

487485

488486
int ip6_input(struct sk_buff *skb)
489487
{
490-
return NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_IN,
491-
dev_net(skb->dev), NULL, skb, skb->dev, NULL,
492-
ip6_input_finish);
488+
int res;
489+
490+
rcu_read_lock();
491+
res = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_IN,
492+
dev_net_rcu(skb->dev), NULL, skb, skb->dev, NULL,
493+
ip6_input_finish);
494+
rcu_read_unlock();
495+
496+
return res;
493497
}
494498
EXPORT_SYMBOL_GPL(ip6_input);
495499

0 commit comments

Comments
 (0)