lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20100227013359.5e50f032@lxorguk.ukuu.org.uk>
Date:	Sat, 27 Feb 2010 01:33:59 +0000
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	Amit Shah <amit.shah@...hat.com>
Cc:	linux-kernel@...r.kernel.org, linuxppc-dev@...abs.org,
	Rusty Russell <rusty@...tcorp.com.au>
Subject: Re: [PATCH] hvc_console: Fix a race between hvc_close and
 hvc_remove

> +	tty_kref_get(hp->tty);
>  	spin_lock_irqsave(&hp->lock, flags);
>  	tty = hp->tty;
>  
> @@ -830,7 +833,9 @@ int hvc_remove(struct hvc_struct *hp)
>  	 * cleaned up the hvc_struct.
>  	 */
>  	if (tty)
> -		tty_hangup(tty);
> +		tty_vhangup(tty);
> +
> +	tty_kref_put(hp->tty);

You need to deref hp->tty, take the kref under the lock (and indeed do
all assignments to it that way too), then tty_kref_put(tty), otherwise
what stops hp->tty changing during the remove ?

Take a look how tty_port_tty_get() and tty_port.c does it ...

Alan
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ