public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Drokin <green@linuxhacker.ru>
To: alan@redhat.com, linux-kernel@vger.kernel.org,
	R.E.Wolff@BitWizard.nl, torvalds@transmeta.com
Subject: Memleak in driver for the Specialix SX series cards.
Date: Wed, 12 Mar 2003 23:41:14 +0300	[thread overview]
Message-ID: <20030312204114.GA28438@linuxhacker.ru> (raw)

Hello!

    I see there is a memleak in driver for the Specialix SX series cards
    on error exit path in sx_fw_ioctl() (both in 2.4 and 2.5).
    See the patch.
    Found with help of smatch + unfree script.

Bye,
    Oleg

===== drivers/char/sx.c 1.13 vs edited =====
--- 1.13/drivers/char/sx.c	Fri Nov  8 21:16:55 2002
+++ edited/drivers/char/sx.c	Wed Mar 12 23:38:33 2003
@@ -1734,8 +1734,10 @@
 				if (copy_from_user(tmp, (char *)data + i, 
 						   (i + SX_CHUNK_SIZE >
 						    nbytes) ? nbytes - i :
-						   	      SX_CHUNK_SIZE))
+						   	      SX_CHUNK_SIZE)) {
+					kfree (tmp);
 					return -EFAULT;
+				}
 				memcpy_toio    ((char *) (board->base2 + offset + i), tmp, 
 				                (i+SX_CHUNK_SIZE>nbytes)?nbytes-i:SX_CHUNK_SIZE);
 			}

             reply	other threads:[~2003-03-12 20:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-12 20:41 Oleg Drokin [this message]
2003-03-12 21:05 ` Memleak in driver for the Specialix SX series cards Rogier Wolff

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=20030312204114.GA28438@linuxhacker.ru \
    --to=green@linuxhacker.ru \
    --cc=R.E.Wolff@BitWizard.nl \
    --cc=alan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --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