public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Tommi Rantala <tt.rantala@gmail•com>
To: netdev@vger•kernel.org
Cc: Samuel Ortiz <samuel@sortiz•org>,
	"David S. Miller" <davem@davemloft•net>,
	Dave Jones <davej@redhat•com>,
	Tommi Rantala <tt.rantala@gmail•com>
Subject: [PATCH] irda: irttp: fix memory leak in irttp_open_tsap() error path
Date: Mon, 26 Nov 2012 16:16:44 +0200	[thread overview]
Message-ID: <1353939404-19264-1-git-send-email-tt.rantala@gmail.com> (raw)

Cleanup the memory we allocated earlier in irttp_open_tsap() when we hit
this error path. The leak goes back to at least 1da177e4
("Linux-2.6.12-rc2").

Discovered with Trinity (the syscall fuzzer).

Signed-off-by: Tommi Rantala <tt.rantala@gmail•com>
---
 net/irda/irttp.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 1002e33..ae43c62 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -441,6 +441,7 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify)
 	lsap = irlmp_open_lsap(stsap_sel, &ttp_notify, 0);
 	if (lsap == NULL) {
 		IRDA_DEBUG(0, "%s: unable to allocate LSAP!!\n", __func__);
+		__irttp_close_tsap(self);
 		return NULL;
 	}
 
-- 
1.7.9.5

             reply	other threads:[~2012-11-26 14:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-26 14:16 Tommi Rantala [this message]
2012-11-28 16:25 ` [PATCH] irda: irttp: fix memory leak in irttp_open_tsap() error path David 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=1353939404-19264-1-git-send-email-tt.rantala@gmail.com \
    --to=tt.rantala@gmail$(echo .)com \
    --cc=davej@redhat$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=samuel@sortiz$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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