Skip to contentSkip to conversation

Patch "ethtool: Use kcalloc instead of kmalloc for ethtool_get_strings" has been added to the 4.2-stable tree

PATCH [email protected] 1 participant 1 message Oct 23, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

ethtool: Use kcalloc instead of kmalloc for ethtool_get_strings

to the 4.2-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
ethtool-use-kcalloc-instead-of-kmalloc-for-ethtool_get_strings.patch
and it can be found in the queue-4.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Thu Oct 22 17:25:24 PDT 2015

From: Joe Perches <[email protected]>
Date: Wed, 14 Oct 2015 01:09:40 -0700
Subject: ethtool: Use kcalloc instead of kmalloc for ethtool_get_strings

From: Joe Perches <[email protected]>

[ Upstream commit 077cb37fcf6f00a45f375161200b5ee0cd4e937b ]

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.

---
 net/core/ethtool.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/ethtool.c +1 -1
@@ -1284,7 +1284,7 @@ static int ethtool_get_strings(struct ne
 
 	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;
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.2/ethtool-use-kcalloc-instead-of-kmalloc-for-ethtool_get_strings.patch