aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Ahern <dsa@cumulusnetworks.com>2017-01-10 15:22:25 -0800
committerDavid S. Miller <davem@davemloft.net>2017-01-11 10:04:01 -0500
commit24c63bbc18e25d5d8439422aa5fd2d66390b88eb (patch)
tree7706deaa26f79bb4c4878399cb93448613bba7b2
parentnet: phy: marvell: fix Marvell 88E1512 used in SGMII mode (diff)
downloadlinux-dev-24c63bbc18e25d5d8439422aa5fd2d66390b88eb.tar.xz
linux-dev-24c63bbc18e25d5d8439422aa5fd2d66390b88eb.zip
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") Reported-by: Frank Kellermann <frank.kellermann@atos.net> Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/vrf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 0a067708aa39..454f907d419a 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -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;