Commit 5577ba7d authored by Andrew Morton's avatar Andrew Morton Committed by Dave Jones

[PATCH] Fix memleak in e100 driver

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.
parent a35100e0
......@@ -3784,11 +3784,15 @@ static int e100_ethtool_gstrings(struct net_device *dev, struct ifreq *ifr)
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment