[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190130094934.4231-1-johan@kernel.org>
Date: Wed, 30 Jan 2019 10:49:34 +0100
From: Johan Hovold <johan@...nel.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: speakup@...ux-speakup.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org, Johan Hovold <johan@...nel.org>,
stable <stable@...r.kernel.org>,
Okash Khawaja <okash.khawaja@...il.com>,
Samuel Thibault <samuel.thibault@...-lyon.org>
Subject: [PATCH] staging: speakup: fix tty-operation NULL derefs
The send_xchar() and tiocmset() tty operations are optional. Add the
missing sanity checks to prevent user-space triggerable NULL-pointer
dereferences.
Fixes: 6b9ad1c742bf ("staging: speakup: add send_xchar, tiocmset and input functionality for tty")
Cc: stable <stable@...r.kernel.org> # 4.13
Cc: Okash Khawaja <okash.khawaja@...il.com>
Cc: Samuel Thibault <samuel.thibault@...-lyon.org>
Signed-off-by: Johan Hovold <johan@...nel.org>
---
drivers/staging/speakup/spk_ttyio.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c
index c92bbd05516e..005de0024dd4 100644
--- a/drivers/staging/speakup/spk_ttyio.c
+++ b/drivers/staging/speakup/spk_ttyio.c
@@ -265,7 +265,8 @@ static void spk_ttyio_send_xchar(char ch)
return;
}
- speakup_tty->ops->send_xchar(speakup_tty, ch);
+ if (speakup_tty->ops->send_xchar)
+ speakup_tty->ops->send_xchar(speakup_tty, ch);
mutex_unlock(&speakup_tty_mutex);
}
@@ -277,7 +278,8 @@ static void spk_ttyio_tiocmset(unsigned int set, unsigned int clear)
return;
}
- speakup_tty->ops->tiocmset(speakup_tty, set, clear);
+ if (speakup_tty->ops->tiocmset)
+ speakup_tty->ops->tiocmset(speakup_tty, set, clear);
mutex_unlock(&speakup_tty_mutex);
}
--
2.20.1
Powered by blists - more mailing lists