

Patch from Oleg Drokin <green@linuxhacker.ru>

    There is a memleak in e100 driver from intel, both in 2.4 and 2.5
    e100_ethtool_gstrings does not free "strings" variable if it cannot
    copy it to userspace.



 drivers/net/e100/e100_main.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff -puN drivers/net/e100/e100_main.c~e100-memleak-fix drivers/net/e100/e100_main.c
--- 25/drivers/net/e100/e100_main.c~e100-memleak-fix	2003-03-12 11:32:27.000000000 -0800
+++ 25-akpm/drivers/net/e100/e100_main.c	2003-03-12 11:32:27.000000000 -0800
@@ -3784,11 +3784,15 @@ static int e100_ethtool_gstrings(struct 
 		return -EOPNOTSUPP;
 	}
 
-	if (copy_to_user(ifr->ifr_data, &info, sizeof (info)))
+	if (copy_to_user(ifr->ifr_data, &info, sizeof (info))) {
+		kfree(strings);
 		return -EFAULT;
+	}
 
-	if (copy_to_user(usr_strings, strings, info.len * ETH_GSTRING_LEN))
+	if (copy_to_user(usr_strings, strings, info.len * ETH_GSTRING_LEN)) {
+		kfree(strings);
 		return -EFAULT;
+	}
 
 	kfree(strings);
 	return 0;

_
