]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
serial: xuartps: Fix out-of-bounds access through DT alias
authorGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 23 Feb 2018 13:38:37 +0000 (14:38 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 14 Aug 2018 10:29:44 +0000 (12:29 +0200)
commitb7f67bf531b4250438c395713dc8daef39410fc5
tree5d1a9e771e0ef08149bc2c0850305f3f00ae728e
parentcf284b68220b6e65b247788984d77808647d1511
serial: xuartps: Fix out-of-bounds access through DT alias

BugLink: http://bugs.launchpad.net/bugs/1783418
[ Upstream commit e7d75e18d0fc3f7193b65282b651f980c778d935 ]

The cdns_uart_port[] array is indexed using a value derived from the
"serialN" alias in DT, which may lead to an out-of-bounds access.

Fix this by adding a range check.

Fixes: 928e9263492069ee ("tty: xuartps: Initialize ports according to aliases")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/tty/serial/xilinx_uartps.c