瀏覽代碼

vxlan: fix incorrect nlattr access in MTU check

The access to the wrong variable could lead to a NULL dereference and
possibly other invalid memory reads in vxlan newlink/changelink requests
with a IFLA_MTU attribute.

Fixes: a985343ba906 "vxlan: refactor verification and application of configuration"
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Matthias Schiffer 8 年之前
父節點
當前提交
019b13ae85
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/net/vxlan.c

+ 1 - 1
drivers/net/vxlan.c

@@ -2727,7 +2727,7 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[],
 	}
 	}
 
 
 	if (tb[IFLA_MTU]) {
 	if (tb[IFLA_MTU]) {
-		u32 mtu = nla_get_u32(data[IFLA_MTU]);
+		u32 mtu = nla_get_u32(tb[IFLA_MTU]);
 
 
 		if (mtu < ETH_MIN_MTU || mtu > ETH_MAX_MTU)
 		if (mtu < ETH_MIN_MTU || mtu > ETH_MAX_MTU)
 			return -EINVAL;
 			return -EINVAL;