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] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 28 Oct 2010 15:34:30 -0500
From:	Timur Tabi <timur@...escale.com>
To:	Alan Cox <alan@...rguk.ukuu.org.uk>
CC:	gregkh <gregkh@...e.de>, lkml <linux-kernel@...r.kernel.org>
Subject: Re: Writing a console/tty driver -- how to use tty_port?

Alan Cox wrote:
> drivers/mmc/card/sdio_uart.c
> 
> is in some ways the best example, it handles all the horrible cases
> including unloading of hardware v open races, its way more than you'd
> need but does illustrate it all.

I see something weird in sdio_uart_install():

	int ret = tty_init_termios(tty);

	if (ret == 0) {
		tty_driver_kref_get(driver);
		tty->count++;
		/* This is the ref sdio_uart_port get provided */
		tty->driver_data = port;
		driver->ttys[idx] = tty;


This function is called by tty_driver_install_tty(), which also does this:

	if (tty_init_termios(tty) == 0) {
		lock_kernel();
		tty_driver_kref_get(driver);
		tty->count++;
		driver->ttys[idx] = tty;
		unlock_kernel();
		return 0;
	}

Assuming that both calls to tty_init_termios(tty) return 0, these three lines
will be executed twice:

		tty_driver_kref_get(driver);
		tty->count++;
		driver->ttys[idx] = tty;

Is that right?

-- 
Timur Tabi
Linux kernel developer at Freescale

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