linux-stable/drivers/pinctrl
Yanjiang Jin 1475ce4ff9 pinctrl: core: make sure strcmp() doesn't get a null parameter
[ Upstream commit 54a58185bf ]

Some drivers, for example, QCOM's qdf2xxx, set groups[gpio].name only
when gpio is valid, and leave invalid gpio names as null.
If we want to access the sys node "pinconf-groups",
pinctrl_get_group_selector() -> get_group_name() may return a null
pointer if group_selector is invalid, then the below Kernel panic
would happen since strcmp() uses this null pointer to do comparison.

 Unable to handle kernel NULL pointer dereference at ss 00000000
el:Internal error: Oops: 9600000[ 143.080279]
SMP
 CPU: 19 PID: 2493 Comm: read_all Tainted: G O
.aarch64 #1
 Hardware name: HXT Semiconductor HXT REP-2 System
 PC is at strcmp+0x18/0x154
 LR is at pinctrl_get_group_selector+0x6c/0xe8
 Process read_all (pid: 2493, stack limit =
 Call trace:
 Exception stack
  strcmp+0x18/0x154
  pin_config_group_get+0x64/0xd8
  pinconf_generic_dump_one+0xd8/0x1c0
  pinconf_generic_dump_pins+0x94/0xc8
  pinconf_groups_show+0xb4/0x104
  seq_read+0x178/0x464
  full_proxy_read+0x6c/0xac
  __vfs_read+0x58/0x178
  vfs_read+0x94/0x164
  SyS_read+0x60/0xc0
  __sys_trace_return+0x0/0x4
 --[ end trace]--
 Kernel panic - not syncing: Fatal exception

Signed-off-by: Yanjiang Jin <yanjiang.jin@hxt-semitech.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-04-20 09:16:01 +02:00
..
actions This is the bulk of pin control changes for v4.19: 2018-08-14 12:31:27 -07:00
aspeed pinctrl: aspeed: Fix documentation 2018-06-28 16:13:12 +02:00
bcm pinctrl: bcm2835: Use raw spinlock for RT compatibility 2019-02-12 19:46:57 +01:00
berlin pinctrl: berlin: fix 'pctrl->functions' allocation in berlin_pinctrl_build_state 2018-08-03 19:28:15 +02:00
cirrus pinctrl: madera: Fix possible NULL pointer with pdata config 2018-08-29 14:02:47 +02:00
freescale pinctrl: freescale: off by one in imx1_pinconf_group_dbg_show() 2018-08-01 23:01:07 +02:00
intel pinctrl: cherryview: fix Strago DMI workaround 2019-02-15 08:10:11 +01:00
mediatek This is the bulk of pin control changes for v4.19: 2018-08-14 12:31:27 -07:00
meson pinctrl: meson: meson8b: add the eth_rxd2 and eth_rxd3 pins 2019-04-05 22:33:15 +02:00
mvebu pinctrl: armada-37xx: add suspend/resume support 2018-06-29 14:41:10 +02:00
nomadik pinctrl: nomadik: silence uninitialized variable warning 2018-08-10 23:14:04 +02:00
pxa
qcom pinctrl: ssbi-gpio: Fix pm8xxx_pin_config_get() to be compliant 2018-11-13 11:08:29 -08:00
samsung pinctrl: samsung: Remove duplicated "wakeup" in printk 2018-08-10 23:01:01 +02:00
sh-pfc This is the bulk of pin control changes for v4.19: 2018-08-14 12:31:27 -07:00
sirf treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
spear treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
sprd headers: separate linux/mod_devicetable.h from linux/platform_device.h 2018-07-07 17:52:26 +02:00
stm32 pinctrl: stm32: add syscfg mask parameter 2018-07-29 22:14:59 +02:00
sunxi pinctrl: sunxi: Correct number of IRQ banks on H6 main pin controller 2019-02-15 08:10:11 +01:00
tegra pinctrl: tegra: Move drivers registration to arch_init level 2018-08-03 19:17:39 +02:00
ti treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
uniphier Char/Misc driver patches for 4.19-rc1 2018-08-18 11:04:51 -07:00
vt8500 treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
zte treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
core.c pinctrl: core: make sure strcmp() doesn't get a null parameter 2019-04-20 09:16:01 +02:00
core.h pinctrl: core: Remove broken remove_last group and pinmux functions 2018-07-17 10:49:49 +02:00
devicetree.c pinctrl: Support stopping deferred probe after initcalls 2018-07-10 17:22:35 +02:00
devicetree.h
Kconfig - New Drivers 2018-08-20 15:38:44 -07:00
Makefile Immutable branch (mfd, chrome) due for the v4.19 window 2018-07-27 08:11:37 +01:00
pinconf-generic.c
pinconf.c
pinconf.h
pinctrl-amd.c pinctrl/amd: poll InterruptEnable bits in amd_gpio_irq_set_type 2018-09-25 12:39:19 +02:00
pinctrl-amd.h pinctrl/amd: fix gpio irq level in debugfs 2018-07-29 22:20:15 +02:00
pinctrl-artpec6.c
pinctrl-as3722.c
pinctrl-at91-pio4.c pinctrl: at91-pio4: Remove redundant return value check 2018-07-16 14:46:11 +02:00
pinctrl-at91.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
pinctrl-at91.h
pinctrl-axp209.c pinctrl: axp209: Fix NULL pointer dereference after allocation 2018-08-10 23:12:43 +02:00
pinctrl-coh901.c
pinctrl-coh901.h
pinctrl-da850-pupd.c
pinctrl-digicolor.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
pinctrl-falcon.c
pinctrl-gemini.c pinctrl: gemini: Mask properly 2018-06-26 09:51:42 +02:00
pinctrl-ingenic.c pinctrl: ingenic: Fix group & function error checking 2018-08-29 13:43:36 +02:00
pinctrl-lantiq.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
pinctrl-lantiq.h
pinctrl-lpc18xx.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
pinctrl-max77620.c pinctrl: max77620: Use define directive for max77620_pinconf_param values 2019-02-27 10:09:03 +01:00
pinctrl-mcp23s08.c pinctrl: mcp23s08: spi: Fix regmap allocation for mcp23s18 2019-03-13 14:02:34 -07:00
pinctrl-ocelot.c pinctrl: ocelot: add support for interrupt controller 2018-08-06 13:00:17 +02:00
pinctrl-oxnas.c
pinctrl-palmas.c
pinctrl-pic32.c
pinctrl-pic32.h
pinctrl-pistachio.c
pinctrl-rk805.c
pinctrl-rockchip.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
pinctrl-rza1.c pinctrl: rza1: Fix selector use for groups and functions 2018-07-17 10:49:33 +02:00
pinctrl-single.c This is the bulk of pin control changes for v4.19: 2018-08-14 12:31:27 -07:00
pinctrl-st.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
pinctrl-sx150x.c pinctrl: sx150x: handle failure case of devm_kstrdup 2019-02-12 19:47:06 +01:00
pinctrl-tb10x.c
pinctrl-u300.c headers: separate linux/mod_devicetable.h from linux/platform_device.h 2018-07-07 17:52:26 +02:00
pinctrl-utils.c
pinctrl-utils.h
pinctrl-xway.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
pinctrl-zynq.c
pinmux.c pinctrl: pinmux: Return selector to the pinctrl driver 2018-07-17 10:48:47 +02:00
pinmux.h pinctrl: core: Remove broken remove_last group and pinmux functions 2018-07-17 10:49:49 +02:00