]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
irda: irttp: fix memory leak in irttp_open_tsap() error path
authorTommi Rantala <tt.rantala@gmail.com>
Mon, 26 Nov 2012 04:16:44 +0000 (04:16 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 28 Nov 2012 16:25:29 +0000 (11:25 -0500)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/irda/irttp.c

index 1002e3396f7287049b41c53e4aaa5cdc285a73e6..ae43c62f9045ba94ced0f025a9ecacb3bf145af1 100644 (file)
@@ -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;
        }