提交 92b95364 编写于 作者: P Paolo Abeni 提交者: David S. Miller

udp: fix possible user after free in error handler

Similar to the previous commit, this addresses the same issue for
ipv4: use a single fetch operation and use the correct rcu
annotation.

Fixes: e7cc0824 ("udp: Support for error handlers of tunnels with arbitrary destination port")
Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
Acked-by: NStefano Brivio <sbrivio@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 424a7cd0
...@@ -562,10 +562,12 @@ static int __udp4_lib_err_encap_no_sk(struct sk_buff *skb, u32 info) ...@@ -562,10 +562,12 @@ static int __udp4_lib_err_encap_no_sk(struct sk_buff *skb, u32 info)
for (i = 0; i < MAX_IPTUN_ENCAP_OPS; i++) { for (i = 0; i < MAX_IPTUN_ENCAP_OPS; i++) {
int (*handler)(struct sk_buff *skb, u32 info); int (*handler)(struct sk_buff *skb, u32 info);
const struct ip_tunnel_encap_ops *encap;
if (!iptun_encaps[i]) encap = rcu_dereference(iptun_encaps[i]);
if (!encap)
continue; continue;
handler = rcu_dereference(iptun_encaps[i]->err_handler); handler = encap->err_handler;
if (handler && !handler(skb, info)) if (handler && !handler(skb, info))
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册