public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Paul Mackerras <paulus@samba.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH]: fix memory leak in ppp filter ioctl error path
Date: Sun, 01 Jun 2003 04:09:44 +0200	[thread overview]
Message-ID: <3ED96068.8070003@trash.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 150 bytes --]

This patch fixes a memory leak in ppp_ioctl,
when copy_from_user fails 'code' isn't freed.
Patch applies to both 2.4 and 2.5.

Best regards,
Patrick


[-- Attachment #2: ppp_filter-memleak.diff --]
[-- Type: text/plain, Size: 994 bytes --]

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1248  -> 1.1249 
#	drivers/net/ppp_generic.c	1.19    -> 1.20   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/06/01	kaber@trash.net	1.1249
# [PPP] fix memory leak in ioctl error path
# --------------------------------------------
#
diff -Nru a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
--- a/drivers/net/ppp_generic.c	Sun Jun  1 03:58:58 2003
+++ b/drivers/net/ppp_generic.c	Sun Jun  1 03:58:58 2003
@@ -666,8 +666,10 @@
 			if (code == 0)
 				break;
 			err = -EFAULT;
-			if (copy_from_user(code, uprog.filter, len))
+			if (copy_from_user(code, uprog.filter, len)) {
+				kfree(code);
 				break;
+			}
 			err = sk_chk_filter(code, uprog.len);
 			if (err) {
 				kfree(code);

                 reply	other threads:[~2003-06-01  1:56 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=3ED96068.8070003@trash.net \
    --to=kaber@trash.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox