diff options
author | Joe Perches <joe@perches.com> | 2015-10-14 01:09:40 -0700 |
---|---|---|
committer | Luis Henriques <luis.henriques@canonical.com> | 2015-10-28 10:33:20 +0000 |
commit | d1a84d87c9b6907b8b90cf28e734ee6e37569b4e (patch) | |
tree | 84bfa37f7b20fcead0cd1098e7f5dc66dd33264e /net/core | |
parent | 48af18da94c0ae9bae9bcb59dc4477ccbea0157c (diff) | |
download | linux-stable-d1a84d87c9b6907b8b90cf28e734ee6e37569b4e.tar.gz linux-stable-d1a84d87c9b6907b8b90cf28e734ee6e37569b4e.tar.bz2 linux-stable-d1a84d87c9b6907b8b90cf28e734ee6e37569b4e.zip |
ethtool: Use kcalloc instead of kmalloc for ethtool_get_strings
commit 077cb37fcf6f00a45f375161200b5ee0cd4e937b upstream.
It seems that kernel memory can leak into userspace by a
kmalloc, ethtool_get_strings, then copy_to_user sequence.
Avoid this by using kcalloc to zero fill the copied buffer.
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/ethtool.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 17cb912793fa..e264527e41f8 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -1255,7 +1255,7 @@ static int ethtool_get_strings(struct net_device *dev, void __user *useraddr) gstrings.len = ret; - data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER); + data = kcalloc(gstrings.len, ETH_GSTRING_LEN, GFP_USER); if (!data) return -ENOMEM; |