Skip to contentSkip to conversation

wan/fsl_ucc_hdlc: info leak in uhdlc_ioctl()

PATCH Superseded Dan Carpenter 3 participants 5 messages Jul 14, 2016 – Jul 15, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wan/fsl_ucc_hdlc: info leak in uhdlc_ioctl()

There is a 2 byte struct whole after line.loopback so we need to clear that out to avoid disclosing stack information.

Fixes c19b6d246a35 ('drivers/net: support hdlc function for QE-UCC')
drivers/net/wan/fsl_ucc_hdlc.c +1 -0
index 19174ac..7608561 100644
@@ -635,6 +635,7 @@ static int uhdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 			ifr->ifr_settings.size = size; /* data size wanted */
 			return -ENOBUFS;
 		}
+		memset(&line, 0, sizeof(line));
 		line.clock_type = priv->clocking;
 		line.clock_rate = 0;
 		line.loopback = 0;
#1 lore raw

Am 14.07.2016 12:34, schrieb Dan Carpenter:

Quoted 11 lines

There is a 2 byte struct whole after line.loopback so we need to clear that out to avoid disclosing stack information.

Fixes c19b6d246a35 ('drivers/net: support hdlc function for QE-UCC')
drivers/net/wan/fsl_ucc_hdlc.c +0 -0
index 19174ac..7608561 100644

drivers/net/wan/fsl_ucc_hdlc.c static int uhdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) · line 641

Quoted 7 lines
drivers/net/wan/fsl_ucc_hdlc.c +1 -0
@@ -635,6 +635,7 @@ static int uhdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 			ifr->ifr_settings.size = size; /* data size wanted */
 			return -ENOBUFS;
 		}
+		memset(&line, 0, sizeof(line));
 		line.clock_type = priv->clocking;
 		line.clock_rate = 0;
 		line.loopback = 0;

In this case
line.clock_rate = 0;
line.loopback = 0;

are not need any more and can be removed
except like them to have for documentation or so.

re,
wh

#2 lore raw

PATCH v2 1/1 wan/fsl_ucc_hdlc: info leak in uhdlc_ioctl()

There is a 2 byte struct whole after line.loopback so we need to clear that out to avoid disclosing stack information.

Fixes c19b6d246a35 ('drivers/net: support hdlc function for QE-UCC')

---
v2: remove the other initialization to zero

drivers/net/wan/fsl_ucc_hdlc.c +1 -2
index 19174ac..6edd48a 100644
@@ -635,9 +635,8 @@ static int uhdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 			ifr->ifr_settings.size = size; /* data size wanted */
 			return -ENOBUFS;
 		}
+		memset(&line, 0, sizeof(line));
 		line.clock_type = priv->clocking;
-		line.clock_rate = 0;
-		line.loopback = 0;
 
 		if (copy_to_user(ifr->ifr_settings.ifs_ifsu.sync, &line, size))
 			return -EFAULT;