[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B7C0DBB.5010801@rsk.demon.co.uk>
Date: Wed, 17 Feb 2010 15:39:39 +0000
From: Richard Kennedy <richard@....demon.co.uk>
To: Alan Cox <alan@...ux.intel.com>
CC: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] vt: Fix refcounting use
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists