[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1549201508.819526930@decadent.org.uk>
Date: Sun, 03 Feb 2019 14:45:08 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org, Denis Kirjanov <kda@...ux-powerpc.org>,
"Thomas Gleixner" <tglx@...utronix.de>,
"Eugene Syromiatnikov" <esyr@...hat.com>,
"Al Viro" <viro@...iv.linux.org.uk>,
"Richard Henderson" <rth@...ddle.net>,
"Kate Stewart" <kstewart@...uxfoundation.org>,
"Philippe Ombredanne" <pombredanne@...b.com>,
"Jiri Slaby" <jslaby@...e.com>,
"Alan Cox" <alan@...rguk.ukuu.org.uk>,
"H. Peter Anvin" <hpa@...or.com>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
"Ivan Kokshaysky" <ink@...assic.park.msu.ru>,
"Cc: Johan Hovold" <johan@...nel.org>,
"Matt Turner" <mattst88@...il.com>
Subject: [PATCH 3.16 164/305] termios, tty/tty_baudrate.c: fix buffer overrun
3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <hpa@...or.com>
commit 991a25194097006ec1e0d2e0814ff920e59e3465 upstream.
On architectures with CBAUDEX == 0 (Alpha and PowerPC), the code in tty_baudrate.c does
not do any limit checking on the tty_baudrate[] array, and in fact a
buffer overrun is possible on both architectures. Add a limit check to
prevent that situation.
This will be followed by a much bigger cleanup/simplification patch.
Signed-off-by: H. Peter Anvin (Intel) <hpa@...or.com>
Requested-by: Cc: Johan Hovold <johan@...nel.org>
Cc: Jiri Slaby <jslaby@...e.com>
Cc: Al Viro <viro@...iv.linux.org.uk>
Cc: Richard Henderson <rth@...ddle.net>
Cc: Ivan Kokshaysky <ink@...assic.park.msu.ru>
Cc: Matt Turner <mattst88@...il.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Kate Stewart <kstewart@...uxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@...b.com>
Cc: Eugene Syromiatnikov <esyr@...hat.com>
Cc: Alan Cox <alan@...rguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
[bwh: Backported to 3.16: adjust filename, context]
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
drivers/tty/tty_ioctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -327,7 +327,7 @@ speed_t tty_termios_baud_rate(struct kte
else
cbaud += 15;
}
- return baud_table[cbaud];
+ return cbaud >= n_baud_table ? 0 : baud_table[cbaud];
}
EXPORT_SYMBOL(tty_termios_baud_rate);
@@ -363,7 +363,7 @@ speed_t tty_termios_input_baud_rate(stru
else
cbaud += 15;
}
- return baud_table[cbaud];
+ return cbaud >= n_baud_table ? 0 : baud_table[cbaud];
#else
return tty_termios_baud_rate(termios);
#endif
Powered by blists - more mailing lists