mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Kennedy <richard@rsk.demon.co.uk>
To: Alan Cox <alan@linux.intel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] vt: Fix refcounting use
Date: Wed, 17 Feb 2010 15:39:39 +0000	[thread overview]
Message-ID: <4B7C0DBB.5010801@rsk.demon.co.uk> (raw)
In-Reply-To: <20100217132317.17289.61570.stgit@localhost.localdomain>

On 17/02/10 13:23, Alan Cox wrote:
> We want to properly refcount the vc tty because of the cases where a vc is
> disassociated from a tty (eg destroyed). At the moment the code isn't safe
> and in fact input even tries to patch up broken pointers as a result!
>
>   static void applkey(struct vc_data *vc, int key, char mode)
> @@ -497,10 +499,12 @@ static void fn_show_ptregs(struct vc_data *vc)
>
>   static void fn_hold(struct vc_data *vc)
>   {
> -	struct tty_struct *tty = vc->port.tty;
> +	struct tty_struct *tty = tty_port_tty_get(&vc->port);
>
> -	if (rep || !tty)
> +	if (rep || !tty) {
> +	        tty_kref_put(tty);
>   		return;
> +        }
>

This is the only bit that immediately stands out..
maybe?
	if (rep || !tty) {
		if (tty)
			tty_kref_put(tty);
		return;
	}

regards
Richard


  reply	other threads:[~2010-02-17 15:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-17 13:22 [RFC 0/3] A little console mystery Alan Cox
2010-02-17 13:23 ` [PATCH 1/3] tty: Make vt's have a tty_port Alan Cox
2010-02-17 13:23 ` [PATCH 2/3] tty: Move the vt_tty field from the vc_data into the standard tty_port Alan Cox
2010-02-17 13:23 ` [PATCH 3/3] vt: Fix refcounting use Alan Cox
2010-02-17 15:39   ` Richard Kennedy [this message]
2010-02-17 16:31     ` 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=4B7C0DBB.5010801@rsk.demon.co.uk \
    --to=richard@rsk.demon.co.uk \
    --cc=alan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome