Patchwork hamradio/yam: fix info leak in ioctl

login
register
mail settings
Submitter Salva Peiró
Date Dec. 13, 2013, 7:46 a.m.
Message ID <1386920767-27962-1-git-send-email-speiro@ai2.upv.es>
Download mbox | patch
Permalink /patch/300932/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Salva Peiró - Dec. 13, 2013, 7:46 a.m.
The yam_ioctl() code fails to initialise the cmd field
of the struct yamdrv_ioctl_cfg. Add an explicit memset(0)
before filling the structure to avoid the 4-byte info leak.

Signed-off-by: Salva Peiró <speiro@ai2.upv.es>
CC: <stable@vger.kernel.org>
---
 drivers/net/hamradio/yam.c |    1 +
 1 file changed, 1 insertion(+)
David Miller - Dec. 17, 2013, 1:11 a.m.
From: Salva Peiró <speiro@ai2.upv.es>
Date: Fri, 13 Dec 2013 08:46:07 +0100

> The yam_ioctl() code fails to initialise the cmd field
> of the struct yamdrv_ioctl_cfg. Add an explicit memset(0)
> before filling the structure to avoid the 4-byte info leak.
> 
> Signed-off-by: Salva Peiró <speiro@ai2.upv.es>

Put this into the SIOCYAMGCFG case statement, which is where the
problem actually exists.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 1971411..bb02c8a 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -953,6 +953,7 @@  static int yam_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 	struct yamdrv_ioctl_mcs *ym;
 	int ioctl_cmd;
 
+	memset(&yi, 0, sizeof(yi));
 	if (copy_from_user(&ioctl_cmd, ifr->ifr_data, sizeof(int)))
 		 return -EFAULT;