]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
serial: mxs-auart: Fix potential infinite loop
authorAnton Vasilyev <vasilyev@ispras.ru>
Tue, 7 Aug 2018 10:59:05 +0000 (13:59 +0300)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 26 Nov 2019 12:16:39 +0000 (13:16 +0100)
commit5270e8b79fc4c7f9bd739c726cd44ca2bc5b15ab
tree15eeea0bc1d29be6a9073f9951b6fa70efb6590c
parent3367a6209ddee276e085cbb0a2e872a6aa82d835
serial: mxs-auart: Fix potential infinite loop

BugLink: https://bugs.launchpad.net/bugs/1853915
[ Upstream commit 5963e8a3122471cadfe0eba41c4ceaeaa5c8bb4d ]

On the error path of mxs_auart_request_gpio_irq() is performed
backward iterating with index i of enum type. Underline enum type
may be unsigned char. In this case check (--i >= 0) will be always
true and error handling goes into infinite loop.

The patch changes the check so that it is valid for signed and unsigned
types.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/tty/serial/mxs-auart.c