Skip to content

Commit

Permalink
vlan: disable SIOCSHWTSTAMP in container
Browse files Browse the repository at this point in the history
With NET_ADMIN enabled in container, a normal user could be mapped to
root and is able to change the real device's rx filter via ioctl on
vlan, which would affect the other ptp process on host. Fix it by
disabling SIOCSHWTSTAMP in container.

Fixes: a6111d3 ("vlan: Pass SIOC[SG]HWTSTAMP ioctls to real device")
Signed-off-by: Hangbin Liu <[email protected]>
Acked-by: Richard Cochran <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
liuhangbin authored and davem330 committed May 9, 2019
1 parent 6c2ea9e commit 873017a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/8021q/vlan_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,12 @@ static int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
ifrr.ifr_ifru = ifr->ifr_ifru;

switch (cmd) {
case SIOCSHWTSTAMP:
if (!net_eq(dev_net(dev), &init_net))
break;
case SIOCGMIIPHY:
case SIOCGMIIREG:
case SIOCSMIIREG:
case SIOCSHWTSTAMP:
case SIOCGHWTSTAMP:
if (netif_device_present(real_dev) && ops->ndo_do_ioctl)
err = ops->ndo_do_ioctl(real_dev, &ifrr, cmd);
Expand Down

0 comments on commit 873017a

Please sign in to comment.