mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/9] tty: Fix leaks introduced by the shift to separate ldisc objects
Date: Tue, 16 Jun 2009 17:00:26 +0100	[thread overview]
Message-ID: <20090616160002.10041.79781.stgit@t61.ukuu.org.uk> (raw)
In-Reply-To: <20090616155552.10041.63479.stgit@t61.ukuu.org.uk>

From: Alan Cox <alan@linux.intel.com>

Gold star for the kmemleak detector.

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/char/tty_ldisc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c
index 39c8f86..94b3e06 100644
--- a/drivers/char/tty_ldisc.c
+++ b/drivers/char/tty_ldisc.c
@@ -148,8 +148,10 @@ static struct tty_ldisc *tty_ldisc_try_get(int disc)
 		}
 	}
 	spin_unlock_irqrestore(&tty_ldisc_lock, flags);
-	if (err)
+	if (err) {
+		kfree(ld);
 		return ERR_PTR(err);
+	}
 	return ld;
 }
 
@@ -262,7 +264,7 @@ const struct file_operations tty_ldiscs_proc_fops = {
  *	@ld: line discipline
  *
  *	Install an instance of a line discipline into a tty structure. The
- *	ldisc must have a reference count above zero to ensure it remains/
+ *	ldisc must have a reference count above zero to ensure it remains.
  *	The tty instance refcount starts at zero.
  *
  *	Locking:


  reply	other threads:[~2009-06-16 15:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-16 15:59 [PATCH 0/9] Series short description Alan Cox
2009-06-16 16:00 ` Alan Cox [this message]
2009-06-16 16:00 ` [PATCH 2/9] ldisc: Make sure the ldisc isn't active when we close it Alan Cox
2009-06-16 16:00 ` [PATCH 3/9] ldisc: debug aids Alan Cox
2009-06-16 16:01 ` [PATCH 4/9] tty: fix unused warning when TCGETX is not defined Alan Cox
2009-06-16 16:01 ` [PATCH 5/9] pty: Narrow the race on ldisc locking Alan Cox
2009-06-16 16:01 ` [PATCH 6/9] tty: fix sanity check Alan Cox
2009-06-16 16:01 ` [PATCH 7/9] MAINTAINERS: update 8250 section, give Alan Cox a name Alan Cox
2009-06-16 16:02 ` [PATCH 8/9] atmel_serial: fix hang in set_termios when crtscts is enabled Alan Cox
2009-06-16 16:02 ` [PATCH 9/9] imx: Check for NULL pointer deref before calling tty_encode_baud_rate Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090616160002.10041.79781.stgit@t61.ukuu.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®