Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: l3mdev: use skb_dst_dev_rcu() in l3mdev_l3_out()

Extend the RCU section a bit so that we can use the safer
skb_dst_dev_rcu() helper.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260130191906.3781856-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
82f35bec 61cef645

+4 -3
+4 -3
include/net/l3mdev.h
··· 207 207 static inline 208 208 struct sk_buff *l3mdev_l3_out(struct sock *sk, struct sk_buff *skb, u16 proto) 209 209 { 210 - struct net_device *dev = skb_dst(skb)->dev; 210 + struct net_device *dev; 211 211 212 + rcu_read_lock(); 213 + dev = skb_dst_dev_rcu(skb); 212 214 if (netif_is_l3_slave(dev)) { 213 215 struct net_device *master; 214 216 215 - rcu_read_lock(); 216 217 master = netdev_master_upper_dev_get_rcu(dev); 217 218 if (master && master->l3mdev_ops->l3mdev_l3_out) 218 219 skb = master->l3mdev_ops->l3mdev_l3_out(master, sk, 219 220 skb, proto); 220 - rcu_read_unlock(); 221 221 } 222 + rcu_read_unlock(); 222 223 223 224 return skb; 224 225 }