mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
ila: block BH in ila_output()
[ Upstream commitcf28ff8e4c] As explained in commit1378817486("tipc: block BH before using dst_cache"), net/core/dst_cache.c helpers need to be called with BH disabled. ila_output() is called from lwtunnel_output() possibly from process context, and under rcu_read_lock(). We might be interrupted by a softirq, re-enter ila_output() and corrupt dst_cache data structures. Fix the race by using local_bh_disable(). Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Paolo Abeni <pabeni@redhat.com> Link: https://lore.kernel.org/r/20240531132636.2637995-5-edumazet@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
5b6ea5b041
commit
9f9c79d8e5
@@ -58,7 +58,9 @@ static int ila_output(struct net *net, struct sock *sk, struct sk_buff *skb)
|
|||||||
return orig_dst->lwtstate->orig_output(net, sk, skb);
|
return orig_dst->lwtstate->orig_output(net, sk, skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local_bh_disable();
|
||||||
dst = dst_cache_get(&ilwt->dst_cache);
|
dst = dst_cache_get(&ilwt->dst_cache);
|
||||||
|
local_bh_enable();
|
||||||
if (unlikely(!dst)) {
|
if (unlikely(!dst)) {
|
||||||
struct ipv6hdr *ip6h = ipv6_hdr(skb);
|
struct ipv6hdr *ip6h = ipv6_hdr(skb);
|
||||||
struct flowi6 fl6;
|
struct flowi6 fl6;
|
||||||
@@ -86,8 +88,11 @@ static int ila_output(struct net *net, struct sock *sk, struct sk_buff *skb)
|
|||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ilwt->connected)
|
if (ilwt->connected) {
|
||||||
|
local_bh_disable();
|
||||||
dst_cache_set_ip6(&ilwt->dst_cache, dst, &fl6.saddr);
|
dst_cache_set_ip6(&ilwt->dst_cache, dst, &fl6.saddr);
|
||||||
|
local_bh_enable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
skb_dst_set(skb, dst);
|
skb_dst_set(skb, dst);
|
||||||
|
|||||||
Reference in New Issue
Block a user