net: vxlan/geneve: use the correct nlattr array for extack
Subsystems (2)
cover net: vxlan/geneve: use the correct nlattr array for extack
The ->validate callbacks for vxlan and geneve have a couple of typos in extack, where the nlattr array for IFLA_* attributes is used instead of the link-specific one.
Sabrina Dubroca (2):
vxlan: use the correct nlattr array in NL_SET_ERR_MSG_ATTR
geneve: use the correct nlattr array in NL_SET_ERR_MSG_ATTR
drivers/net/geneve.c | 2 +- drivers/net/vxlan.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.26.1
PATCH 1/2 vxlan: use the correct nlattr array in NL_SET_ERR_MSG_ATTR
IFLA_VXLAN_* attributes are in the data array, which is correctly used when fetching the value, but not when setting the extended ack. Because IFLA_VXLAN_MAX < IFLA_MAX, we avoid out of bounds array accesses, but we don't provide a pointer to the invalid attribute to userspace.
--- drivers/net/vxlan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/vxlan.c +3 -3
@@ -3144,7 +3144,7 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[],u32 id =nla_get_u32 (data[IFLA_VXLAN_ID ]);if (id >=VXLAN_N_VID ) { -NL_SET_ERR_MSG_ATTR (extack, tb[IFLA_VXLAN_ID ], +NL_SET_ERR_MSG_ATTR (extack, data[IFLA_VXLAN_ID ],"VXLAN ID must be lower than 16777216" );return -ERANGE ; }
@@ -3155,7 +3155,7 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[], = 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 ], +NL_SET_ERR_MSG_ATTR (extack, data[IFLA_VXLAN_PORT_RANGE ],"Invalid source port range" );return -EINVAL ; }
@@ -3165,7 +3165,7 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[],enum ifla_vxlan_df df =nla_get_u8 (data[IFLA_VXLAN_DF ]);if (df <0 || df >VXLAN_DF_MAX ) { -NL_SET_ERR_MSG_ATTR (extack, tb[IFLA_VXLAN_DF ], +NL_SET_ERR_MSG_ATTR (extack, data[IFLA_VXLAN_DF ],"Invalid DF attribute" );return -EINVAL ; }
Signature · 1 line
2.26.1
PATCH 2/2 geneve: use the correct nlattr array in NL_SET_ERR_MSG_ATTR
In reply to Sabrina DubrocaIFLA_GENEVE_* attributes are in the data array, which is correctly used when fetching the value, but not when setting the extended ack. Because IFLA_GENEVE_MAX < IFLA_MAX, we avoid out of bounds array accesses, but we don't provide a pointer to the invalid attribute to userspace.
--- drivers/net/geneve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/geneve.c +1 -1
@@ -1207,7 +1207,7 @@ static int geneve_validate(struct nlattr *tb[], struct nlattr *data[],enum ifla_geneve_df df =nla_get_u8 (data[IFLA_GENEVE_DF ]);if (df <0 || df >GENEVE_DF_MAX ) { -NL_SET_ERR_MSG_ATTR (extack, tb[IFLA_GENEVE_DF ], +NL_SET_ERR_MSG_ATTR (extack, data[IFLA_GENEVE_DF ],"Invalid DF attribute" );return -EINVAL ; }
Signature · 1 line
2.26.1
Quoted 9 lines · Sabrina Dubroca
The ->validate callbacks for vxlan and geneve have a couple of typos in extack, where the nlattr array for IFLA_* attributes is used instead of the link-specific one.
Sabrina Dubroca (2):
vxlan: use the correct nlattr array inNL_SET_ERR_MSG_ATTR
geneve: use the correct nlattr array inNL_SET_ERR_MSG_ATTR
Quoted 7 lines
drivers/net/geneve.c | 2 +- drivers/net/vxlan.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)--
2.26.1
David Miller
maintainerFrom: Sabrina Dubroca <[email protected]>
Date: Wed, 22 Apr 2020 17:29:49 +0200
Quoted 3 lines
The ->validate callbacks for vxlan and geneve have a couple of typos in extack, where the nlattr array for IFLA_* attributes is used instead of the link-specific one.
Series applied and queued up for -stable, thanks.