Skip to content

Commit 81852ef

Browse files
edumazetopsiff
authored andcommitted
vrf: use RCU protection in l3mdev_l3_out()
[ Upstream commit 6d0ce46 ] l3mdev_l3_out() can be called without RCU being held: raw_sendmsg() ip_push_pending_frames() ip_send_skb() ip_local_out() __ip_local_out() l3mdev_ip_out() Add rcu_read_lock() / rcu_read_unlock() pair to avoid a potential UAF. Fixes: a8e3e1a ("net: l3mdev: Add hook to output path") Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: David Ahern <dsahern@kernel.org> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com> Link: https://patch.msgid.link/20250207135841.1948589-7-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit c40cb5c)
1 parent 280a1c2 commit 81852ef

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

include/net/l3mdev.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,12 @@ struct sk_buff *l3mdev_l3_out(struct sock *sk, struct sk_buff *skb, u16 proto)
204204
if (netif_is_l3_slave(dev)) {
205205
struct net_device *master;
206206

207+
rcu_read_lock();
207208
master = netdev_master_upper_dev_get_rcu(dev);
208209
if (master && master->l3mdev_ops->l3mdev_l3_out)
209210
skb = master->l3mdev_ops->l3mdev_l3_out(master, sk,
210211
skb, proto);
212+
rcu_read_unlock();
211213
}
212214

213215
return skb;

0 commit comments

Comments
 (0)