android_kernel_samsung_a7y1.../drivers/clk
Douglas Anderson 99473563ac clk: qcom: rcg2: Don't crash if our parent can't be found; return an error
[ Upstream commit 908b050114d8fefdddc57ec9fbc213c3690e7f5f ]

When I got my clock parenting slightly wrong I ended up with a crash
that looked like this:

  Unable to handle kernel NULL pointer dereference at virtual
  address 0000000000000000
  ...
  pc : clk_hw_get_rate+0x14/0x44
  ...
  Call trace:
   clk_hw_get_rate+0x14/0x44
   _freq_tbl_determine_rate+0x94/0xfc
   clk_rcg2_determine_rate+0x2c/0x38
   clk_core_determine_round_nolock+0x4c/0x88
   clk_core_round_rate_nolock+0x6c/0xa8
   clk_core_round_rate_nolock+0x9c/0xa8
   clk_core_set_rate_nolock+0x70/0x180
   clk_set_rate+0x3c/0x6c
   of_clk_set_defaults+0x254/0x360
   platform_drv_probe+0x28/0xb0
   really_probe+0x120/0x2dc
   driver_probe_device+0x64/0xfc
   device_driver_attach+0x4c/0x6c
   __driver_attach+0xac/0xc0
   bus_for_each_dev+0x84/0xcc
   driver_attach+0x2c/0x38
   bus_add_driver+0xfc/0x1d0
   driver_register+0x64/0xf8
   __platform_driver_register+0x4c/0x58
   msm_drm_register+0x5c/0x60
   ...

It turned out that clk_hw_get_parent_by_index() was returning NULL and
we weren't checking.  Let's check it so that we don't crash.

Fixes: ac269395cdd8 ("clk: qcom: Convert to clk_hw based provider APIs")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Link: https://lkml.kernel.org/r/20200203103049.v4.1.I7487325fe8e701a68a07d3be8a6a4b571eca9cfa@changeid
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-07 13:56:02 +02:00
..
at91
bcm
berlin
h8300
hisilicon
imx clk: vf610: fix refcount leak in vf610_clocks_init() 2020-04-07 13:39:56 +02:00
ingenic
keystone
mediatek
meson
mmp clk: mmp2: Fix the order of timer mux parents 2020-04-07 13:48:33 +02:00
mvebu clk: armada-xp: fix refcount leak in axp_clk_init() 2020-04-07 13:40:01 +02:00
mxs
nxp
pistachio
pxa clk: pxa: fix one of the pxa RTC clocks 2020-04-07 13:23:20 +02:00
qcom clk: qcom: rcg2: Don't crash if our parent can't be found; return an error 2020-04-07 13:56:02 +02:00
rockchip clk: rockchip: fix rk3188 sclk_mac_lbtest parameter ordering 2020-04-07 12:44:23 +02:00
samsung clk: samsung: exynos4: fix refcount leak in exynos4_get_xom() 2020-04-07 13:39:48 +02:00
shmobile
sirf clk: sirf: Don't reference clk_init_data after registration 2020-04-07 07:42:56 +02:00
socfpga clk: socfpga: fix refcount leak 2020-04-07 13:39:46 +02:00
spear
st
sunxi
tegra
ti
ux500
versatile
x86
zte
zynq
clk-asm9260.c
clk-axi-clkgen.c
clk-axm5516.c
clk-cdce706.c
clk-cdce925.c
clk-clps711x.c
clk-composite.c
clk-conf.c
clk-devres.c
clk-divider.c
clk-efm32gg.c
clk-fixed-factor.c
clk-fixed-rate.c
clk-fractional-divider.c
clk-gate.c
clk-gpio.c
clk-highbank.c clk: highbank: fix refcount leak in hb_clk_init() 2020-04-07 13:39:43 +02:00
clk-ls1x.c
clk-max-gen.c
clk-max-gen.h
clk-max77686.c
clk-max77802.c
clk-mb86s7x.c
clk-moxart.c
clk-multiplier.c
clk-mux.c
clk-nomadik.c
clk-nspire.c
clk-palmas.c
clk-pwm.c
clk-qoriq.c clk: qoriq: fix refcount leak in clockgen_init() 2020-04-07 13:39:44 +02:00
clk-rk808.c
clk-s2mps11.c clk: s2mps11: Add used attribute to s2mps11_dt_match 2020-04-06 21:34:59 +02:00
clk-scpi.c
clk-si514.c
clk-si570.c
clk-si5351.c
clk-si5351.h
clk-stm32f4.c
clk-twl6040.c
clk-u300.c
clk-vt8500.c
clk-wm831x.c
clk-xgene.c
clk.c
clk.h
clkdev.c
Kconfig
Makefile