net: clear heap allocation for ETHTOOL_GRXCLSRLALL
Subsystems (2)
PATCH 1/1 net: clear heap allocation for ETHTOOL_GRXCLSRLALL
Calling ETHTOOL_GRXCLSRLALL with a large rule_cnt will allocate kernel heap without clearing it. For the one driver (niu) that implements it, it will leave the unused portion of heap unchanged and copy the full contents back to userspace.
--- net/core/ethtool.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/core/ethtool.c +1 -1
@@ -348,7 +348,7 @@ static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,if (info.cmd ==ETHTOOL_GRXCLSRLALL ) {if (info.rule_cnt >0 ) {if (info.rule_cnt <=KMALLOC_MAX_SIZE /sizeof (u32)) - rule_buf =kmalloc (info.rule_cnt *sizeof (u32), + rule_buf =kzalloc (info.rule_cnt *sizeof (u32),GFP_USER );if (!rule_buf)return -ENOMEM ;
Signature · 5 lines
1.7.1 -- Kees Cook Ubuntu Security Team
Quoted 7 lines · Kees Cook
Calling
ETHTOOL_GRXCLSRLALLwith a largerule_cntwill allocate kernel heap without clearing it. For the one driver (niu) that implements it, it will leave the unused portion of heap unchanged and copy the full contents back to userspace.Signed-off-by Kees Cook <[email protected]>
Should have spotted this myself. :-(
Ben.
Quoted 20 lines
--- net/core/ethtool.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)net/core/ethtool.c +1
-1@@ -348,7 +348,7 @@ static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,if (info.cmd ==ETHTOOL_GRXCLSRLALL ) {if (info.rule_cnt >0 ) {if (info.rule_cnt <=KMALLOC_MAX_SIZE /sizeof (u32)) - rule_buf =kmalloc (info.rule_cnt *sizeof (u32), + rule_buf =kzalloc (info.rule_cnt *sizeof (u32),GFP_USER );if (!rule_buf)return -ENOMEM ;Signature · 1 line
1.7.1
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
David Miller
maintainerFrom: Ben Hutchings <[email protected]>
Date: Thu, 07 Oct 2010 21:28:58 +0100
Quoted 10 lines · Kees Cook
Quoted 7 lines
Calling
ETHTOOL_GRXCLSRLALLwith a largerule_cntwill allocate kernel heap without clearing it. For the one driver (niu) that implements it, it will leave the unused portion of heap unchanged and copy the full contents back to userspace.Signed-off-by Kees Cook <[email protected]>Acked-by Ben Hutchings <[email protected]>
Applied and queued up for -stable, thanks.