Commit 70e05a9f authored by David Ahern's avatar David Ahern Committed by Greg Kroah-Hartman

net: vrf: do not allow table id 0

[ Upstream commit 24c63bbc ]

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: 193125db ("net: Introduce VRF device driver")
Reported-by: default avatarFrank Kellermann <frank.kellermann@atos.net>
Signed-off-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c177d491
...@@ -925,6 +925,8 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev, ...@@ -925,6 +925,8 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev,
return -EINVAL; return -EINVAL;
vrf->tb_id = nla_get_u32(data[IFLA_VRF_TABLE]); 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; dev->priv_flags |= IFF_L3MDEV_MASTER;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment