Skip to content

Commit

Permalink
net: vrf: do not allow table id 0
Browse files Browse the repository at this point in the history
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: 193125d ("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>
  • Loading branch information
David Ahern authored and davem330 committed Jan 11, 2017
1 parent a13c065 commit 24c63bb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/vrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 24c63bb

Please sign in to comment.