Skip to contentSkip to conversation

net: vrf: do not allow table id 0

PATCH In review David Ahern 2 participants 2 messages Jan 10, 2017 – Jan 11, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: vrf: do not allow table id 0

Frank reported that vrf devices can be created with a table id of 0. This breaks many of the run time table id checks and should not be allowed. Detect this condition at create time and fail with EINVAL.

Fixes 193125dbd8eb ("net: Introduce VRF device driver")
---
 drivers/net/vrf.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/vrf.c +2 -0
index 0a067708aa39..454f907d419a 100644
@@ -1252,6 +1252,8 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev,
 		return -EINVAL;
 
 	vrf->tb_id = nla_get_u32(data[IFLA_VRF_TABLE]);
+	if (vrf->tb_id == RT_TABLE_UNSPEC)
+		return -EINVAL;
 
 	dev->priv_flags |= IFF_L3MDEV_MASTER;
 
Signature · 1 line
2.1.4
maintainer
#1 lore raw

From: David Ahern <[email protected]>
Date: Tue, 10 Jan 2017 15:22:25 -0800

Quoted 7 lines

Frank reported that vrf devices can be created with a table id of 0. This breaks many of the run time table id checks and should not be allowed. Detect this condition at create time and fail with EINVAL.

Fixes 193125dbd8eb ("net: Introduce VRF device driver")

Applied and queued up for -stable, thanks David.