All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Drokin <green@linuxhacker.ru>
To: alan@redhat.com, davem@redhat.com, linux-kernel@vger.kernel.org
Subject: memleak in 802.1q vlan proc code
Date: Mon, 10 Mar 2003 00:21:52 +0300	[thread overview]
Message-ID: <20030309212152.GA31920@linuxhacker.ru> (raw)

Hello!

   There is a memleak on error exit path, identical in 2.4 and 2.5.
   Same patch should apply to 2.4 and 2.5.

   Found with help of smatch + enhanced unfree script.

Bye,
    Oleg
===== net/8021q/vlanproc.c 1.6 vs edited =====
--- 1.6/net/8021q/vlanproc.c	Sat Aug 10 06:36:57 2002
+++ edited/net/8021q/vlanproc.c	Mon Mar 10 00:17:23 2003
@@ -252,8 +252,10 @@
 	offs = file->f_pos;
 	if (offs < pos) {
 		len = min_t(int, pos - offs, count);
-		if (copy_to_user(buf, (page + offs), len))
+		if (copy_to_user(buf, (page + offs), len)) {
+			kfree(page);
 			return -EFAULT;
+		}
 
 		file->f_pos += len;
 	} else {

             reply	other threads:[~2003-03-09 21:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-09 21:21 Oleg Drokin [this message]
2003-03-09 21:41 ` memleak in 802.1q vlan proc code David S. Miller

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=20030309212152.GA31920@linuxhacker.ru \
    --to=green@linuxhacker.ru \
    --cc=alan@redhat.com \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.