mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
serial: mxs-auart: Fix potential infinite loop
[ Upstream commit 5963e8a312
]
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>
This commit is contained in:
parent
925ed8333e
commit
73e22730e1
1 changed files with 2 additions and 1 deletions
|
@ -1638,8 +1638,9 @@ static int mxs_auart_request_gpio_irq(struct mxs_auart_port *s)
|
|||
|
||||
/*
|
||||
* If something went wrong, rollback.
|
||||
* Be careful: i may be unsigned.
|
||||
*/
|
||||
while (err && (--i >= 0))
|
||||
while (err && (i-- > 0))
|
||||
if (irq[i] >= 0)
|
||||
free_irq(irq[i], s);
|
||||
|
||||
|
|
Loading…
Reference in a new issue