summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-tps65219.c
diff options
context:
space:
mode:
authorChunyan Zhang <chunyan.zhang@unisoc.com>2023-07-25 08:40:52 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-07-30 13:53:55 +0200
commitf9608f1887568b728839d006024585ab02ef29e5 (patch)
tree03a58751de9d96983560b116ac048e3b44412edc /drivers/gpio/gpio-tps65219.c
parentserial: sc16is7xx: Put IOControl register into regmap_volatile (diff)
downloadlinux-f9608f1887568b728839d006024585ab02ef29e5.tar.xz
linux-f9608f1887568b728839d006024585ab02ef29e5.zip
serial: sprd: Assign sprd_port after initialized to avoid wrong access
The global pointer 'sprd_port' may not zero when sprd_probe returns failure, that is a risk for sprd_port to be accessed afterward, and may lead to unexpected errors. For example: There are two UART ports, UART1 is used for console and configured in kernel command line, i.e. "console="; The UART1 probe failed and the memory allocated to sprd_port[1] was released, but sprd_port[1] was not set to NULL; In UART2 probe, the same virtual address was allocated to sprd_port[2], and UART2 probe process finally will go into sprd_console_setup() to register UART1 as console since it is configured as preferred console (filled to console_cmdline[]), but the console parameters (sprd_port[1]) belong to UART2. So move the sprd_port[] assignment to where the port already initialized can avoid the above issue. Fixes: b7396a38fb28 ("tty/serial: Add Spreadtrum sc9836-uart driver support") Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Link: https://lore.kernel.org/r/20230725064053.235448-1-chunyan.zhang@unisoc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/gpio/gpio-tps65219.c')
0 files changed, 0 insertions, 0 deletions