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

From: Okash Khawaja
Date: Thu Jul 13 2017 - 07:25:04 EST

On Wed, Jul 12, 2017 at 07:25:22PM +0100, Alan Cox wrote:
> > spk_ttyio_initialise_ldisc is called separately for each module (e.g.
> > speakup_apollo, speakup_ltlk etc) when it is loaded. spk_ttyio_release
> > is also called separately for each module when it is unloaded. The ldisc
> > stays around until the last of the modules is unloaded.
> What guarantees that someone hasn't decided to set the ldisc on unrelated
> hardware to speakup (eg on a pty/tty pair).
> >
> > >
> > > I'd also btw strongly recommend putting the ldisc and the speakup tty
> > > driver as different modules.
> > Sure, that makes sense. I will do that following these patches.
> If the ldisc is just unregistered when the module implementing it is
> unloaded then the ref counts on the ldisc module should do everything
> needed if the above isn't correctly handled, and if it is will still be
> cleaner.

Right, I understand now. Thanks. I will update and resend this patch.