devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] serial: Fix out-of-bounds accesses through DT aliases
@ 2018-02-20  9:40 Geert Uytterhoeven
  2018-02-20  9:40 ` [PATCH 1/9] serial: arc_uart: Fix out-of-bounds access through DT alias Geert Uytterhoeven
                   ` (8 more replies)
  0 siblings, 9 replies; 24+ messages in thread
From: Geert Uytterhoeven @ 2018-02-20  9:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devicetree, Barry Song, Geert Uytterhoeven, Vineet Gupta,
	Michal Simek, linux-kernel, linux-renesas-soc, linux-serial,
	Jiri Slaby, linux-snps-arc, linux-arm-kernel

	Hi all,

Serial drivers used on DT platforms use the "serialN" alias in DT to
obtain the serial port index for a specific port.  Drivers typically use
a fixed-size array for keeping track of all available serial ports.
However, several drivers do not perform any validation on the index
obtained from DT, which may lead to out-of-bounds accesses of these
fixed-size arrays.

While the DTB passed to the kernel might be considered trusted, some of
these out-of-bounds accesses can be triggered by a legitimate DTB:
  - In some drivers the size of the array is defined by a Kconfig
    symbol, so a user who doesn't need all serial ports may lower this
    value rightfully,
  - Tomorrow's new SoC may have more serial ports than the fixed-size
    array in today's driver can accommodate, which the user may forget
    to enlarge.

Hence this series fixes that by adding checks for out-of-range aliases,
logging an error message when triggered.

Tested on r8a7791/koelsch (sh-sci), all other drivers were
compile-tested only.

Thanks for your comments!

Geert Uytterhoeven (9):
  serial: arc_uart: Fix out-of-bounds access through DT alias
  serial: fsl_lpuart: Fix out-of-bounds access through DT alias
  serial: imx: Fix out-of-bounds access through DT alias
  serial: mxs-auart: Fix out-of-bounds access through DT alias
  serial: pxa: Fix out-of-bounds access through DT alias
  serial: samsung: Fix out-of-bounds access through DT alias
  serial: sh-sci: Fix out-of-bounds access through DT alias
  serial: sirf: Fix out-of-bounds access through DT alias
  serial: xuartps: Fix out-of-bounds access through DT alias

 drivers/tty/serial/arc_uart.c      | 5 +++++
 drivers/tty/serial/fsl_lpuart.c    | 4 ++++
 drivers/tty/serial/imx.c           | 5 +++++
 drivers/tty/serial/mxs-auart.c     | 4 ++++
 drivers/tty/serial/pxa.c           | 4 ++++
 drivers/tty/serial/samsung.c       | 4 ++++
 drivers/tty/serial/sh-sci.c        | 4 ++++
 drivers/tty/serial/sirfsoc_uart.c  | 5 +++++
 drivers/tty/serial/xilinx_uartps.c | 2 +-
 9 files changed, 36 insertions(+), 1 deletion(-)

-- 
2.7.4

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2018-02-20 12:39 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-20  9:40 [PATCH 0/9] serial: Fix out-of-bounds accesses through DT aliases Geert Uytterhoeven
2018-02-20  9:40 ` [PATCH 1/9] serial: arc_uart: Fix out-of-bounds access through DT alias Geert Uytterhoeven
2018-02-20 10:50   ` Geert Uytterhoeven
2018-02-20  9:40 ` [PATCH 2/9] serial: fsl_lpuart: " Geert Uytterhoeven
2018-02-20 10:51   ` Geert Uytterhoeven
2018-02-20  9:40 ` [PATCH 3/9] serial: imx: " Geert Uytterhoeven
2018-02-20 10:31   ` Uwe Kleine-König
2018-02-20 10:49     ` Geert Uytterhoeven
2018-02-20  9:40 ` [PATCH 4/9] serial: mxs-auart: " Geert Uytterhoeven
2018-02-20 10:51   ` Geert Uytterhoeven
2018-02-20  9:40 ` [PATCH 5/9] serial: pxa: " Geert Uytterhoeven
2018-02-20 10:52   ` Geert Uytterhoeven
2018-02-20  9:40 ` [PATCH 6/9] serial: samsung: " Geert Uytterhoeven
2018-02-20 10:52   ` Geert Uytterhoeven
2018-02-20  9:40 ` [PATCH 7/9] serial: sh-sci: " Geert Uytterhoeven
2018-02-20 10:53   ` Geert Uytterhoeven
2018-02-20  9:40 ` [PATCH 8/9] serial: sirf: " Geert Uytterhoeven
2018-02-20 10:53   ` Geert Uytterhoeven
2018-02-20  9:40 ` [PATCH 9/9] serial: xuartps: " Geert Uytterhoeven
2018-02-20 10:22   ` Michal Simek
2018-02-20 10:38     ` Geert Uytterhoeven
2018-02-20 11:27       ` Michal Simek
2018-02-20 12:27         ` Geert Uytterhoeven
2018-02-20 12:39           ` Michal Simek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).