mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
mptcp: Use __sk_dst_get() and dst_dev_rcu() in mptcp_active_enable().
[ Upstream commit893c49a78d] mptcp_active_enable() is called from subflow_finish_connect(), which is icsk->icsk_af_ops->sk_rx_dst_set() and it's not always under RCU. Using sk_dst_get(sk)->dev could trigger UAF. Let's use __sk_dst_get() and dst_dev_rcu(). Fixes:27069e7cb3("mptcp: disable active MPTCP in case of blackhole") Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20250916214758.650211-8-kuniyu@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0a14dbd8a2
commit
cc976ec9e3
@@ -501,12 +501,15 @@ void mptcp_active_enable(struct sock *sk)
|
||||
struct mptcp_pernet *pernet = mptcp_get_pernet(sock_net(sk));
|
||||
|
||||
if (atomic_read(&pernet->active_disable_times)) {
|
||||
struct dst_entry *dst = sk_dst_get(sk);
|
||||
struct net_device *dev;
|
||||
struct dst_entry *dst;
|
||||
|
||||
if (dst && dst->dev && (dst->dev->flags & IFF_LOOPBACK))
|
||||
rcu_read_lock();
|
||||
dst = __sk_dst_get(sk);
|
||||
dev = dst ? dst_dev_rcu(dst) : NULL;
|
||||
if (dev && (dev->flags & IFF_LOOPBACK))
|
||||
atomic_set(&pernet->active_disable_times, 0);
|
||||
|
||||
dst_release(dst);
|
||||
rcu_read_unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user