* [PATCH net 1/2] vxlan: use the correct nlattr array in NL_SET_ERR_MSG_ATTR
2020-04-22 15:29 [PATCH net 0/2] net: vxlan/geneve: use the correct nlattr array for extack Sabrina Dubroca
@ 2020-04-22 15:29 ` Sabrina Dubroca
2020-04-22 15:29 ` [PATCH net 2/2] geneve: " Sabrina Dubroca
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Sabrina Dubroca @ 2020-04-22 15:29 UTC (permalink / raw)
To: netdev
Cc: Xin Long, Stefano Brivio, Girish Moodalbail, Matthias Schiffer,
Sabrina Dubroca
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.
Fixes: 653ef6a3e4af ("vxlan: change vxlan_[config_]validate() to use netlink_ext_ack for error reporting")
Fixes: b4d3069783bc ("vxlan: Allow configuration of DF behaviour")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
drivers/net/vxlan.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 45308b3350cf..a5b415fed11e 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -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;
}
--
2.26.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH net 2/2] geneve: use the correct nlattr array in NL_SET_ERR_MSG_ATTR
2020-04-22 15:29 [PATCH net 0/2] net: vxlan/geneve: use the correct nlattr array for extack Sabrina Dubroca
2020-04-22 15:29 ` [PATCH net 1/2] vxlan: use the correct nlattr array in NL_SET_ERR_MSG_ATTR Sabrina Dubroca
@ 2020-04-22 15:29 ` Sabrina Dubroca
2020-04-22 15:48 ` [PATCH net 0/2] net: vxlan/geneve: use the correct nlattr array for extack Xin Long
2020-04-23 19:40 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Sabrina Dubroca @ 2020-04-22 15:29 UTC (permalink / raw)
To: netdev
Cc: Xin Long, Stefano Brivio, Girish Moodalbail, Matthias Schiffer,
Sabrina Dubroca
IFLA_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.
Fixes: a025fb5f49ad ("geneve: Allow configuration of DF behaviour")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
drivers/net/geneve.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 09f279c0182b..6b461be1820b 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -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;
}
--
2.26.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net 0/2] net: vxlan/geneve: use the correct nlattr array for extack
2020-04-22 15:29 [PATCH net 0/2] net: vxlan/geneve: use the correct nlattr array for extack Sabrina Dubroca
2020-04-22 15:29 ` [PATCH net 1/2] vxlan: use the correct nlattr array in NL_SET_ERR_MSG_ATTR Sabrina Dubroca
2020-04-22 15:29 ` [PATCH net 2/2] geneve: " Sabrina Dubroca
@ 2020-04-22 15:48 ` Xin Long
2020-04-23 19:40 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Xin Long @ 2020-04-22 15:48 UTC (permalink / raw)
To: Sabrina Dubroca
Cc: network dev, Stefano Brivio, Girish Moodalbail, Matthias Schiffer
On Wed, Apr 22, 2020 at 11:30 PM Sabrina Dubroca <sd@queasysnail.net> wrote:
>
> 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(-)
>
> --
> 2.26.1
>
Reviewed-by: Xin Long <lucien.xin@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net 0/2] net: vxlan/geneve: use the correct nlattr array for extack
2020-04-22 15:29 [PATCH net 0/2] net: vxlan/geneve: use the correct nlattr array for extack Sabrina Dubroca
` (2 preceding siblings ...)
2020-04-22 15:48 ` [PATCH net 0/2] net: vxlan/geneve: use the correct nlattr array for extack Xin Long
@ 2020-04-23 19:40 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2020-04-23 19:40 UTC (permalink / raw)
To: sd; +Cc: netdev, lucien.xin, sbrivio, girish.moodalbail, mschiffer
From: Sabrina Dubroca <sd@queasysnail.net>
Date: Wed, 22 Apr 2020 17:29:49 +0200
> 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.
^ permalink raw reply [flat|nested] 5+ messages in thread