linux/drivers/clk/mvebu
Linus Walleij aaedb9e00e clk: kirkwood: Fix a clocking boot regression
Since a few kernel releases the Pogoplug 4 has crashed like this
during boot:

Unable to handle kernel NULL pointer dereference at virtual address 00000002
(...)
[<c04116ec>] (strlen) from [<c00ead80>] (kstrdup+0x1c/0x4c)
[<c00ead80>] (kstrdup) from [<c04591d8>] (__clk_register+0x44/0x37c)
[<c04591d8>] (__clk_register) from [<c04595ec>] (clk_hw_register+0x20/0x44)
[<c04595ec>] (clk_hw_register) from [<c045bfa8>] (__clk_hw_register_mux+0x198/0x1e4)
[<c045bfa8>] (__clk_hw_register_mux) from [<c045c050>] (clk_register_mux_table+0x5c/0x6c)
[<c045c050>] (clk_register_mux_table) from [<c0acf3e0>] (kirkwood_clk_muxing_setup.constprop.0+0x13c/0x1ac)
[<c0acf3e0>] (kirkwood_clk_muxing_setup.constprop.0) from [<c0aceae0>] (of_clk_init+0x12c/0x214)
[<c0aceae0>] (of_clk_init) from [<c0ab576c>] (time_init+0x20/0x2c)
[<c0ab576c>] (time_init) from [<c0ab3d18>] (start_kernel+0x3dc/0x56c)
[<c0ab3d18>] (start_kernel) from [<00000000>] (0x0)
Code: e3130020 1afffffb e12fff1e c08a1078 (e5d03000)

This is because the "powersave" mux clock 0 was provided in an unterminated
array, which is required by the loop in the driver:

        /* Count, allocate, and register clock muxes */
        for (n = 0; desc[n].name;)
                n++;

Here n will go out of bounds and then call clk_register_mux() on random
memory contents after the mux clock.

Fix this by terminating the array with a blank entry.

Fixes: 105299381d ("cpufreq: kirkwood: use the powersave multiplexer")
Cc: stable@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210814235514.403426-1-linus.walleij@linaro.org
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
2021-08-28 21:11:22 -07:00
..
ap806-system-controller.c clk: mvebu: ap80x: add AP807 clock support 2019-09-17 22:15:41 -07:00
ap-cpu-clk.c clk: mvebu: ap-cpu-clk: Demote non-conformant kernel-doc header 2021-02-11 11:56:06 -08:00
armada_ap_cp_helper.c clk: mvebu: add helper file for Armada AP and CP clocks 2019-08-08 09:08:09 -07:00
armada_ap_cp_helper.h clk: mvebu: add helper file for Armada AP and CP clocks 2019-08-08 09:08:09 -07:00
armada-37xx-periph.c clk: mvebu: armada-37xx-periph: Fix workaround for switching from L1 to L0 2021-04-09 15:17:33 +05:30
armada-37xx-tbg.c clk: Remove io.h from clk-provider.h 2019-05-15 13:21:37 -07:00
armada-37xx-xtal.c clk: mvebu: a3700: fix the XTAL MODE pin to MPP1_9 2020-12-19 15:51:18 -08:00
armada-38x.c clk: mvebu: use SPDX-License-Identifier 2018-10-01 15:12:47 -07:00
armada-39x.c clk: mvebu: use SPDX-License-Identifier 2018-10-01 15:12:47 -07:00
armada-370.c clk: armada-370: fix refcount leak in a370_clk_init() 2018-12-28 11:42:41 -08:00
armada-375.c clk: mvebu: use SPDX-License-Identifier 2018-10-01 15:12:47 -07:00
armada-xp.c clk: armada-xp: remove unused code 2019-11-13 13:19:56 -08:00
clk-corediv.c clk: Remove io.h from clk-provider.h 2019-05-15 13:21:37 -07:00
clk-cpu.c This time it looks like a quieter release cycle in the clk tree. I guess that's 2018-10-31 11:08:30 -07:00
common.c clk: mvebu: fix spelling mistake "gatable" -> "gateable" 2019-04-18 14:53:23 -07:00
common.h clk: mvebu: use SPDX-License-Identifier 2018-10-01 15:12:47 -07:00
cp110-system-controller.c drivers/clk: convert VL struct to struct_size 2019-11-08 08:36:12 -08:00
dove-divider.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dove-divider.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dove.c clk: dove: fix refcount leak in dove_clk_init() 2018-12-28 11:45:43 -08:00
Kconfig clk: mvebu: ARMADA_AP_CPU_CLK needs to select ARMADA_AP_CP_HELPER 2020-07-11 09:07:06 -07:00
kirkwood.c clk: kirkwood: Fix a clocking boot regression 2021-08-28 21:11:22 -07:00
Makefile clk: mvebu: add CPU clock driver for Armada 7K/8K 2019-08-08 09:08:09 -07:00
mv98dx3236.c clk: mv98dx3236: fix refcount leak in mv98dx3236_clk_init() 2018-12-28 11:45:41 -08:00
orion.c clk: mvebu: use SPDX-License-Identifier 2018-10-01 15:12:47 -07:00