Skip to content

Commit 5dbd506

Browse files
Amerigo Wangdavem330
authored andcommitted
ipv6,gre: do not leak info to user-space
There is a hole in struct ip6_tnl_parm2, so we have to zero the struct on stack before copying it to user-space. Cc: David S. Miller <[email protected]> Signed-off-by: Cong Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d34710e commit 5dbd506

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/ipv6/ip6_gre.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,7 @@ static int ip6gre_tunnel_ioctl(struct net_device *dev,
10811081
}
10821082
if (t == NULL)
10831083
t = netdev_priv(dev);
1084+
memset(&p, 0, sizeof(p));
10841085
ip6gre_tnl_parm_to_user(&p, &t->parms);
10851086
if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
10861087
err = -EFAULT;
@@ -1128,6 +1129,7 @@ static int ip6gre_tunnel_ioctl(struct net_device *dev,
11281129
if (t) {
11291130
err = 0;
11301131

1132+
memset(&p, 0, sizeof(p));
11311133
ip6gre_tnl_parm_to_user(&p, &t->parms);
11321134
if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
11331135
err = -EFAULT;

0 commit comments

Comments
 (0)