diff mbox

irda: irttp: fix memory leak in irttp_open_tsap() error path

Message ID 1353939404-19264-1-git-send-email-tt.rantala@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Tommi Rantala Nov. 26, 2012, 2:16 p.m. UTC
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(+)

Comments

David Miller Nov. 28, 2012, 4:25 p.m. UTC | #1
From: Tommi Rantala <tt.rantala@gmail.com>
Date: Mon, 26 Nov 2012 16:16:44 +0200

> 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>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;
 	}