From: Oleg Drokin <green@linuxhacker.ru>
To: scott.feldman@intel.com, alan@redhat.com, torvalds@transmeta.com,
linux-kernel@vger.kernel.org
Subject: Memleak in e100 driver
Date: Wed, 12 Mar 2003 21:58:06 +0300 [thread overview]
Message-ID: <20030312185806.GA27489@linuxhacker.ru> (raw)
Hello!
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.
See the patch (identical for both 2.4 and 2.5).
Found with help of smatch + enhanced unfree script.
Bye,
Oleg
===== drivers/net/e100/e100_main.c 1.23 vs edited =====
--- 1.23/drivers/net/e100/e100_main.c Sat Feb 1 22:38:18 2003
+++ edited/drivers/net/e100/e100_main.c Wed Mar 12 21:50:32 2003
@@ -3824,11 +3824,15 @@
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;
reply other threads:[~2003-03-12 18:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030312185806.GA27489@linuxhacker.ru \
--to=green@linuxhacker.ru \
--cc=alan@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=scott.feldman@intel.com \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox