netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@redhat.com>
Cc: netdev@oss.sgi.com
Subject: [PATCH]: Fix memory leak in ah6.c
Date: Fri, 28 May 2004 12:50:29 +0200	[thread overview]
Message-ID: <40B71975.1080909@trash.net> (raw)

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

Hi Dave,

this patch fixes a memory leak in ah6.c. iph is not freed when
ipv6_clear_mutable_options fails.

Regards
Patrick

[-- Attachment #2: ah6-memleak.diff --]
[-- Type: text/x-patch, Size: 874 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/05/28 12:21:37+02:00 kaber@trash.net 
#   [IPSEC]: Fix memory leak in ah6.c
# 
# net/ipv6/ah6.c
#   2004/05/28 12:21:29+02:00 kaber@trash.net +3 -1
#   [IPSEC]: Fix memory leak in ah6.c
# 
diff -Nru a/net/ipv6/ah6.c b/net/ipv6/ah6.c
--- a/net/ipv6/ah6.c	2004-05-28 12:34:25 +02:00
+++ b/net/ipv6/ah6.c	2004-05-28 12:34:25 +02:00
@@ -190,7 +190,7 @@
 		memcpy(skb->nh.ipv6h, iph, hdr_len);
 		nexthdr = ipv6_clear_mutable_options(skb, &nh_offset, XFRM_POLICY_OUT);
 		if (nexthdr == 0)
-			goto error;
+			goto error_free_iph;
 
 		skb->nh.raw[nh_offset] = IPPROTO_AH;
 		skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
@@ -239,6 +239,8 @@
 		goto error_nolock;
 	}
 	return NET_XMIT_BYPASS;
+error_free_iph:
+	kfree(iph);
 error:
 	spin_unlock_bh(&x->lock);
 error_nolock:

             reply	other threads:[~2004-05-28 10:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-28 10:50 Patrick McHardy [this message]
2004-05-29 19:37 ` [PATCH]: Fix memory leak in ah6.c 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=40B71975.1080909@trash.net \
    --to=kaber@trash.net \
    --cc=davem@redhat.com \
    --cc=netdev@oss.sgi.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;
as well as URLs for NNTP newsgroup(s).