From: Kees Cook Date: Mon, 11 Oct 2010 19:23:25 +0000 (-0700) Subject: net: clear heap allocations for privileged ethtool actions X-Git-Tag: v2.6.33.8~452 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=487a1f7338ff740bde0d15f97c44b7b8029cc9c7;p=thirdparty%2Fkernel%2Fstable.git net: clear heap allocations for privileged ethtool actions [ Upstream commit b00916b189d13a615ff05c9242201135992fcda3 ] Several other ethtool functions leave heap uncleared (potentially) by drivers. Some interfaces appear safe (eeprom, etc), in that the sizes are well controlled. In some situations (e.g. unchecked error conditions), the heap will remain unchanged in areas before copying back to userspace. Note that these are less of an issue since these all require CAP_NET_ADMIN. Cc: stable@kernel.org Signed-off-by: Kees Cook Acked-by: Ben Hutchings Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/core/ethtool.c b/net/core/ethtool.c index ed2fb75e0d00c..310ba1c28083d 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -304,7 +304,7 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr) if (regs.len > reglen) regs.len = reglen; - regbuf = kmalloc(reglen, GFP_USER); + regbuf = kzalloc(reglen, GFP_USER); if (!regbuf) return -ENOMEM;