mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
vxlan: check tun_info options_len properly
[ Upstream commiteadf52cf18] 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:ee122c79d4("vxlan: Flow based tunneling") Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -2049,8 +2049,11 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
|
||||
label = info->key.label;
|
||||
udp_sum = !!(info->key.tun_flags & TUNNEL_CSUM);
|
||||
|
||||
if (info->options_len)
|
||||
if (info->options_len) {
|
||||
if (info->options_len < sizeof(*md))
|
||||
goto drop;
|
||||
md = ip_tunnel_info_opts(info);
|
||||
}
|
||||
} else {
|
||||
md->gbp = skb->mark;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user