Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1308605

Re: memory leak in lapb_create_cb

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: memory leak in lapb_create_cb
Date 2016-01-13 17:50 +0100
Message-ID <qQwMs-2sp-49@gated-at.bofh.it> (permalink)
References <qLwal-3mE-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Dmitry Vyukov <dvyukov@google.com>
Date: Wed, 30 Dec 2015 22:00:44 +0100

> The following program leads to a leak of struct lapb_cb:

I looked into this report a bit, and although I couldn't figure out
how lapb_cb could be leaked, I definitely found an x25_asy object
leak in this driver.

====================
[PATCH] x25_asy: Free x25_asy on x25_asy_open() failure.

Based upon a report by Dmitry Vyukov.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/wan/x25_asy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
index cd39025..1bc5e93 100644
--- a/drivers/net/wan/x25_asy.c
+++ b/drivers/net/wan/x25_asy.c
@@ -571,8 +571,10 @@ static int x25_asy_open_tty(struct tty_struct *tty)
 
 	/* Perform the low-level X.25 async init */
 	err = x25_asy_open(sl->dev);
-	if (err)
+	if (err) {
+		x25_asy_free(sl);
 		return err;
+	}
 	/* Done.  We have linked the TTY line to a channel. */
 	return 0;
 }
-- 
2.1.0

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: memory leak in lapb_create_cb David Miller <davem@davemloft.net> - 2016-01-13 17:50 +0100

csiph-web