summaryrefslogtreecommitdiff
path: root/drivers/accessibility/speakup
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-11-30 08:33:06 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-11-30 08:33:06 +0100
commit3473065927a877e0a15c4d4b64f245ccaba24e3f (patch)
tree5d4ebdd84c192e8b2ca6c8f6be32e07f240c836c /drivers/accessibility/speakup
parentf80c21509984190b7fd462ed2c9ac5a294a99dc5 (diff)
parentb65054597872ce3aefbc6a666385eabdf9e288da (diff)
Merge 5.10-rc6 into char-misc-next
We need the fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/accessibility/speakup')
-rw-r--r--drivers/accessibility/speakup/spk_ttyio.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/accessibility/speakup/spk_ttyio.c b/drivers/accessibility/speakup/spk_ttyio.c
index ecc39983e946..669392f31d4e 100644
--- a/drivers/accessibility/speakup/spk_ttyio.c
+++ b/drivers/accessibility/speakup/spk_ttyio.c
@@ -49,15 +49,25 @@ static int spk_ttyio_ldisc_open(struct tty_struct *tty)
if (!tty->ops->write)
return -EOPNOTSUPP;
+
+ mutex_lock(&speakup_tty_mutex);
+ if (speakup_tty) {
+ mutex_unlock(&speakup_tty_mutex);
+ return -EBUSY;
+ }
speakup_tty = tty;
ldisc_data = kmalloc(sizeof(*ldisc_data), GFP_KERNEL);
- if (!ldisc_data)
+ if (!ldisc_data) {
+ speakup_tty = NULL;
+ mutex_unlock(&speakup_tty_mutex);
return -ENOMEM;
+ }
init_completion(&ldisc_data->completion);
ldisc_data->buf_free = true;
speakup_tty->disc_data = ldisc_data;
+ mutex_unlock(&speakup_tty_mutex);
return 0;
}