Re: [patch] staging: speakup: safely close tty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 7 Jul 2017 20:13:01 +0100
Okash Khawaja <okash.khawaja@xxxxxxxxx> wrote:

> Speakup opens tty using tty_open_by_driver. When closing, it calls
> tty_ldisc_release but doesn't close and remove the tty itself. As a
> result, that tty cannot then be opened from user space. This patch calls
> tty_release_struct which ensures that tty is safely removed and freed
> up. It also calls tty_ldisc_release, so speakup doesn't need to call it.
> 
> This patch also unregisters N_SPEAKUP. It is registered when a speakup
> module is loaded.

What happens if after you register it someone assigns that ldisc to
another tty as well ?

You should register the ldisc when the relevant module is initialized and
release it only when the module is unloaded. That way the module ref
counts will handle cases where someone uses the ldisc with something else.

I'd also btw strongly recommend putting the ldisc and the speakup tty
driver as different modules.

Alan
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux