public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/4] staging: dgap: fix memory leak caused by double allocation of tty_structs
@ 2014-11-06 10:27 Daeseok Youn
  0 siblings, 0 replies; only message in thread
From: Daeseok Youn @ 2014-11-06 10:27 UTC (permalink / raw)
  To: lidza.louina, markh
  Cc: markh, daeseok.youn, gregkh, driverdev-devel, devel, linux-kernel

The tty_struct of serial_driver and print_driver were getting
allocated twice. One is allocated in tty_alloc_driver(), the other
is in dgap_tty_register(). So remove these in dgap_tty_register().

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
---
 drivers/staging/dgap/dgap.c |   16 ----------------
 1 files changed, 0 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 6418cc5..688aaa4 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -5254,14 +5254,6 @@ static int dgap_tty_register(struct board_t *brd)
 	brd->serial_driver->init_termios = dgap_default_termios;
 	brd->serial_driver->driver_name = DRVSTR;
 
-	/* The kernel wants space to store pointers to tty_structs */
-	brd->serial_driver->ttys =
-		kzalloc(MAXPORTS * sizeof(struct tty_struct *), GFP_KERNEL);
-	if (!brd->serial_driver->ttys) {
-		rc = -ENOMEM;
-		goto free_serial_drv;
-	}
-
 	/*
 	 * Entry points for driver.  Called by the kernel from
 	 * tty_io.c and n_tty.c.
@@ -5293,14 +5285,6 @@ static int dgap_tty_register(struct board_t *brd)
 	brd->print_driver->init_termios = dgap_default_termios;
 	brd->print_driver->driver_name = DRVSTR;
 
-	/* The kernel wants space to store pointers to tty_structs */
-	brd->print_driver->ttys =
-		kzalloc(MAXPORTS * sizeof(struct tty_struct *), GFP_KERNEL);
-	if (!brd->print_driver->ttys) {
-		rc = -ENOMEM;
-		goto free_print_drv;
-	}
-
 	/*
 	 * Entry points for driver.  Called by the kernel from
 	 * tty_io.c and n_tty.c.
-- 
1.7.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-11-06 10:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-06 10:27 [PATCH 2/4] staging: dgap: fix memory leak caused by double allocation of tty_structs Daeseok Youn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox