public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
To: Okash Khawaja <okash.khawaja@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Samuel Thibault <samuel.thibault@ens-lyon.org>,
	linux-kernel@vger.kernel.org, William Hubbs <w.d.hubbs@gmail.com>,
	Chris Brannon <chris@the-brannons.com>,
	Kirk Reiser <kirk@reisers.ca>,
	speakup@linux-speakup.org, devel@driverdev.osuosl.org
Subject: Re: [patch] staging: speakup: safely close tty
Date: Mon, 10 Jul 2017 12:55:44 +0100	[thread overview]
Message-ID: <20170710125544.2aa4d12a@alans-desktop> (raw)
In-Reply-To: <20170707191301.GA3798@sanghar>

On Fri, 7 Jul 2017 20:13:01 +0100
Okash Khawaja <okash.khawaja@gmail.com> 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

  reply	other threads:[~2017-07-10 11:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-07 19:13 [patch] staging: speakup: safely close tty Okash Khawaja
2017-07-10 11:55 ` Alan Cox [this message]
2017-07-11 10:39   ` Okash Khawaja
2017-07-12 18:25     ` Alan Cox
2017-07-13 11:24       ` Okash Khawaja
2017-07-16  9:28       ` [patch v2 0/1] " Okash Khawaja
2017-07-16  9:28         ` [patch v2 1/1] " Okash Khawaja

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170710125544.2aa4d12a@alans-desktop \
    --to=gnomes@lxorguk.ukuu.org.uk \
    --cc=chris@the-brannons.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kirk@reisers.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=okash.khawaja@gmail.com \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=speakup@linux-speakup.org \
    --cc=w.d.hubbs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox