Skip to contentSkip to conversation

ipv6,gre: do not leak info to user-space

PATCH Applied Cong Wang 2 participants 2 messages May 10, 2013 – May 12, 2013

Subsystems (3)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 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]>

---

net/ipv6/ip6_gre.c +2 -0
index d3ddd84..ecd6073 100644
@@ -1081,6 +1081,7 @@ static int ip6gre_tunnel_ioctl(struct net_device *dev,
 		}
 		if (t == NULL)
 			t = netdev_priv(dev);
+		memset(&p, 0, sizeof(p));
 		ip6gre_tnl_parm_to_user(&p, &t->parms);
 		if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
 			err = -EFAULT;
@@ -1128,6 +1129,7 @@ static int ip6gre_tunnel_ioctl(struct net_device *dev,
 		if (t) {
 			err = 0;
 
+			memset(&p, 0, sizeof(p));
 			ip6gre_tnl_parm_to_user(&p, &t->parms);
 			if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p)))
 				err = -EFAULT;