Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: pxa: Fix an error handling path in 'serial_pxa_probe()'

If port.line is out of range, we still need to release some resources, or
we will leak them.

Fixes: afc7851fab83 ("serial: pxa: Fix out-of-bounds access through serial port index")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Christophe JAILLET and committed by
Greg Kroah-Hartman
95a0e656 4cf9a888

+2 -1
+2 -1
drivers/tty/serial/pxa.c
··· 887 887 goto err_clk; 888 888 if (sport->port.line >= ARRAY_SIZE(serial_pxa_ports)) { 889 889 dev_err(&dev->dev, "serial%d out of range\n", sport->port.line); 890 - return -EINVAL; 890 + ret = -EINVAL; 891 + goto err_clk; 891 892 } 892 893 snprintf(sport->name, PXA_NAME_LEN - 1, "UART%d", sport->port.line + 1); 893 894