linux/drivers/clocksource
Chen-Yu Tsai 5938768388 Revert "clocksource/drivers/timer_sun5i: Replace code by clocksource_mmio_init"
struct clocksource is also used by the clk notifier callback, to
unregister and re-register the clocksource with a different clock rate.
clocksource_mmio_init does not pass back a pointer to the struct used,
and the clk notifier callback assumes that the struct clocksource in
struct sun5i_timer_clksrc is valid. This results in a kernel NULL
pointer dereference when the hstimer clock is changed:

Unable to handle kernel NULL pointer dereference at virtual address 00000004
[<c03a4678>] (clocksource_unbind) from [<c03a46d4>] (clocksource_unregister+0x2c/0x44)
[<c03a46d4>] (clocksource_unregister) from [<c0a6f350>] (sun5i_rate_cb_clksrc+0x34/0x3c)
[<c0a6f350>] (sun5i_rate_cb_clksrc) from [<c035ea50>] (notifier_call_chain+0x44/0x84)
[<c035ea50>] (notifier_call_chain) from [<c035edc0>] (__srcu_notifier_call_chain+0x44/0x60)
[<c035edc0>] (__srcu_notifier_call_chain) from [<c035edf4>] (srcu_notifier_call_chain+0x18/0x20)
[<c035edf4>] (srcu_notifier_call_chain) from [<c0670174>] (__clk_notify+0x70/0x7c)
[<c0670174>] (__clk_notify) from [<c06702c0>] (clk_propagate_rate_change+0xa4/0xc4)
[<c06702c0>] (clk_propagate_rate_change) from [<c0670288>] (clk_propagate_rate_change+0x6c/0xc4)

Revert the commit for now. clocksource_mmio_init can be made to pass back
a pointer, but the code churn and usage of an inner struct might not be
worth it.

Fixes: 157dfadef8 ("clocksource/drivers/timer_sun5i: Replace code by clocksource_mmio_init")
Reported-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Cc: linux-sunxi@googlegroups.com
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/20161018054918.26855-1-wens@csie.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2016-10-20 21:58:58 +02:00
..
Kconfig clocksource: Add J-Core timer/clocksource driver 2016-10-20 20:10:17 +02:00
Makefile clocksource: Add J-Core timer/clocksource driver 2016-10-20 20:10:17 +02:00
acpi_pm.c clocksource/drivers/acpi_pm: Convert to pr_* macros 2015-12-29 12:52:57 +01:00
arm_arch_timer.c arm/arm64: arch_timer: Use archdata to indicate vdso suitability 2016-09-23 17:19:25 +01:00
arm_global_timer.c clocksource/arm_global_timer: Convert to hotplug state machine 2016-07-15 10:41:44 +02:00
armv7m_systick.c clocksource/drivers/armv7m_systick: Add the COMPILE_TEST option 2016-06-28 10:22:05 +02:00
asm9260_timer.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
bcm2835_timer.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
bcm_kona_timer.c clocksource/drivers/kona: Fix get_counter() error handling 2016-08-17 13:08:31 +02:00
cadence_ttc_timer.c clocksource/drivers/cadence_ttc: fix a return value in case of error 2016-07-07 09:44:38 +02:00
clksrc-dbx500-prcmu.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
clksrc-probe.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
clksrc_st_lpc.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
clps711x-timer.c ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
cs5535-clockevt.c clockevents/drivers/cs5535: Migrate to new 'set-state' interface 2015-08-06 12:16:42 +02:00
dummy_timer.c clocksource/dummy_timer: Convert to hotplug state machine 2016-07-15 10:40:24 +02:00
dw_apb_timer.c clockevents/drivers/dw_apb_timer: Implement ->set_state_oneshot_stopped() 2016-04-28 15:09:03 +02:00
dw_apb_timer_of.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
em_sti.c clocksource/drivers/em_sti: Remove unneeded memset()s 2015-10-15 17:41:59 +02:00
exynos_mct.c clocksource: exynos_mct: Add the support for ARM64 2016-09-16 13:07:53 +02:00
fsl_ftm_timer.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
h8300_timer8.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
h8300_timer16.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
h8300_tpu.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
i8253.c clockevents/drivers/i8253: Migrate to new 'set-state' interface 2015-08-10 11:40:30 +02:00
jcore-pit.c clocksource: Add J-Core timer/clocksource driver 2016-10-20 20:10:17 +02:00
meson6_timer.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
metag_generic.c clocksource/metag: Convert to hotplug state machine 2016-07-15 10:40:25 +02:00
mips-gic-timer.c clocksource/mips-gic-timer: Stop checking cpu_has_counter 2016-09-20 23:24:33 +02:00
mmio.c clocksource: Mmio: remove artificial 32bit limitation 2015-12-10 19:37:18 +01:00
moxart_timer.c clocksource/drivers/moxart: Replace panic by pr_err 2016-09-12 07:28:38 +02:00
mps2-timer.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
mtk_timer.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
mxs_timer.c clocksource/drivers/mxs: Remove useless header <asm/mach/time.h> 2016-06-28 10:22:09 +02:00
nomadik-mtu.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
numachip.c x86/numachip: Fix timer build conflict 2015-09-23 05:39:20 +02:00
pxa_timer.c clocksource/drivers/pxa: Fix include files for compilation 2016-08-24 11:16:38 +02:00
qcom-timer.c clocksource/qcom-timer: Convert to hotplug state machine 2016-07-15 10:40:25 +02:00
rockchip_timer.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
samsung_pwm_timer.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
scx200_hrt.c clocksource: scx200_hrt: Fix the build 2012-02-22 13:25:16 +01:00
sh_cmt.c clocksource/drivers/sh_cmt: Remove unneeded memset() in sh_cmt_setup() 2015-10-15 17:42:00 +02:00
sh_mtu2.c clocksource/drivers/sh_mtu2: Fix multiple shutdown call issue 2015-10-28 15:22:56 +01:00
sh_tmu.c clocksource/drivers/sh_tmu: Fix traceback spotted in -next 2015-08-10 11:40:57 +02:00
sun4i_timer.c clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe function 2016-08-26 15:56:01 +02:00
tango_xtal.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
tcb_clksrc.c clockevents/tcb_clksrc: Prevent disabling an already disabled clock 2016-01-15 11:40:44 +01:00
tegra20_timer.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
time-armada-370-xp.c clocksource/drivers/time-armada-370-xp: Fix the clock reference 2016-08-17 13:08:31 +02:00
time-efm32.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
time-lpc32xx.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
time-orion.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
time-pistachio.c drivers/clocksource/pistachio: Fix memory corruption in init 2016-08-26 15:55:59 +02:00
timer-atlas7.c clocksource/atlas7: Convert to hotplug state machine 2016-07-15 10:41:45 +02:00
timer-atmel-pit.c clocksource/drivers/timer-atmel-pit: Simplify IRQ handler 2016-09-12 07:28:46 +02:00
timer-atmel-st.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
timer-digicolor.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
timer-imx-gpt.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
timer-integrator-ap.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
timer-keystone.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
timer-nps.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
timer-oxnas-rps.c clocksource/drivers/oxnas: Add OX820 compatible 2016-09-12 07:28:46 +02:00
timer-prima2.c clocksource/drivers/prima2: Remove useless header <asm/mach/time.h> 2016-06-28 10:22:11 +02:00
timer-sp.h ARM: 8366/1: move Dual-Timer SP804 driver to drivers/clocksource 2015-06-02 09:58:18 +01:00
timer-sp804.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
timer-stm32.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
timer-sun5i.c Revert "clocksource/drivers/timer_sun5i: Replace code by clocksource_mmio_init" 2016-10-20 21:58:58 +02:00
timer-ti-32k.c clocksource/drivers/ti-32k: Prevent ftrace recursion 2016-09-22 16:49:19 +02:00
timer-u300.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
versatile.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
vf_pit_timer.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
vt8500_timer.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00
zevio-timer.c clocksources: Switch back to the clksrc table 2016-06-28 10:19:35 +02:00