提交 eadf52cf 编写于 作者: X Xin Long 提交者: David S. Miller

vxlan: check tun_info options_len properly

This patch is to improve the tun_info options_len by dropping
the skb when TUNNEL_VXLAN_OPT is set but options_len is less
than vxlan_metadata. This can void a potential out-of-bounds
access on ip_tun_info.

Fixes: ee122c79 ("vxlan: Flow based tunneling")
Signed-off-by: NXin Long <lucien.xin@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2eb8d6d2
...@@ -2487,9 +2487,11 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, ...@@ -2487,9 +2487,11 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
vni = tunnel_id_to_key32(info->key.tun_id); vni = tunnel_id_to_key32(info->key.tun_id);
ifindex = 0; ifindex = 0;
dst_cache = &info->dst_cache; dst_cache = &info->dst_cache;
if (info->options_len && if (info->key.tun_flags & TUNNEL_VXLAN_OPT) {
info->key.tun_flags & TUNNEL_VXLAN_OPT) if (info->options_len < sizeof(*md))
goto drop;
md = ip_tunnel_info_opts(info); md = ip_tunnel_info_opts(info);
}
ttl = info->key.ttl; ttl = info->key.ttl;
tos = info->key.tos; tos = info->key.tos;
label = info->key.label; label = info->key.label;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册