Re: memory leak in lapb_create_cb
From: David Miller
Date: Wed Jan 13 2016 - 11:46:42 EST
From: Dmitry Vyukov <dvyukov@xxxxxxxxxx>
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@xxxxxxxxxxxxx>
---
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