Bug 203867

Summary: invalid parameter to NL_SET_ERR_MSG_ATTR() in vxlan.c and geneve.c
Product: Networking Reporter: Kirill Kuteynikov (krkx2)
Component: OtherAssignee: Stephen Hemminger (stephen)
Status: NEW ---    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: v5.2.0-rc4 Subsystem:
Regression: No Bisected commit-id:
Attachments: patch for vxlan.c and geneve.c

Description Kirill Kuteynikov 2019-06-12 07:49:06 UTC
Created attachment 283213 [details]
patch for vxlan.c and geneve.c

Looks like invalid 'attr' parameter is passed to NL_SET_ERR_MSG_ATTR() in drivers/net/vxlan.c and drivers/net/geneve.c for number of attributes.

For example `tb[IFLA_VXLAN_PORT_RANGE]` instead of `data[IFLA_VXLAN_PORT_RANGE]` in piece of code below.

	if (data[IFLA_VXLAN_PORT_RANGE]) {
		const struct ifla_vxlan_port_range *p
			= nla_data(data[IFLA_VXLAN_PORT_RANGE]);

		if (ntohs(p->high) < ntohs(p->low)) {
			NL_SET_ERR_MSG_ATTR(extack, tb[IFLA_VXLAN_PORT_RANGE],
					    "Invalid source port range");
			return -EINVAL;
		}
	}

In case this is really a bug, patch is provided in attach.