linux/drivers/clk
Stephen Boyd 293ba3b4a4 clk: Fix double free due to devm_clk_register()
Now that clk_unregister() frees the struct clk we're
unregistering we'll free memory twice: first we'll call kfree()
in __clk_release() with an address kmalloc doesn't know about and
second we'll call kfree() in the devres layer. Remove the
allocation of struct clk in devm_clk_register() and let
clk_release() handle it. This fixes slab errors like:

=============================================================================
BUG kmalloc-128 (Not tainted): Invalid object pointer 0xed08e8d0
-----------------------------------------------------------------------------

Disabling lock debugging due to kernel taint
INFO: Slab 0xeec503f8 objects=25 used=15 fp=0xed08ea00 flags=0x4081
CPU: 2 PID: 73 Comm: rmmod Tainted: G    B         3.14.0-11032-g526e9c764381 #34
[<c0014be0>] (unwind_backtrace) from [<c0012240>] (show_stack+0x10/0x14)
[<c0012240>] (show_stack) from [<c04b74dc>] (dump_stack+0x70/0xbc)
[<c04b74dc>] (dump_stack) from [<c00f6778>] (slab_err+0x74/0x84)
[<c00f6778>] (slab_err) from [<c04b6278>] (free_debug_processing+0x2cc/0x31c)
[<c04b6278>] (free_debug_processing) from [<c04b6300>] (__slab_free+0x38/0x41c)
[<c04b6300>] (__slab_free) from [<c03931bc>] (clk_unregister+0xd4/0x140)
[<c03931bc>] (clk_unregister) from [<c02fb774>] (release_nodes+0x164/0x1d8)
[<c02fb774>] (release_nodes) from [<c02f8698>] (__device_release_driver+0x60/0xb0)
[<c02f8698>] (__device_release_driver) from [<c02f9080>] (driver_detach+0xb4/0xb8)
[<c02f9080>] (driver_detach) from [<c02f8480>] (bus_remove_driver+0x5c/0xc4)
[<c02f8480>] (bus_remove_driver) from [<c008c9b8>] (SyS_delete_module+0x148/0x1d8)
[<c008c9b8>] (SyS_delete_module) from [<c000ef80>] (ret_fast_syscall+0x0/0x48)
FIX kmalloc-128: Object at 0xed08e8d0 not freed

Fixes: fcb0ee6a3d (clk: Implement clk_unregister)
Cc: Jiada Wang <jiada_wang@mentor.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Cc: stable@vger.kernel.org
2014-04-30 11:44:04 -07:00
..
at91 clk: at91: optimization of the set_rate callback 2014-03-19 15:22:02 -07:00
bcm clk: bcm281xx: don't use unnamed structs or unions 2014-04-30 11:43:58 -07:00
hisilicon clk: hisilicon: fix warning from smatch 2014-03-20 19:05:39 -07:00
keystone clk: keystone: gate: fix clk_init_data initialization 2014-02-10 15:17:43 -05:00
mmp clk: mmp: try to use closer one when do round rate 2014-03-26 20:59:27 -07:00
mvebu clock: mvebu new SoC changes for v3.15 (incremental pull #2) 2014-03-18 21:34:45 -07:00
mxs ARM: mxs: remove custom .init_time hook 2013-09-29 21:09:34 +02:00
qcom clk: qcom: Fix modular build 2014-01-17 13:39:42 -08:00
rockchip clk: add support for Rockchip gate clocks 2013-06-20 15:58:27 -07:00
samsung Exynos cleanup for v3.15 2014-03-29 02:03:39 +01:00
shmobile The clock framework changes for 3.15 look similar to past pull requests. 2014-04-05 18:39:18 -07:00
sirf clk: sirf: update copyright years to 2014 2014-03-26 21:47:35 -07:00
socfpga clk: socfpga: fix clock driver for 3.15 2014-04-30 11:44:01 -07:00
spear clk: SPEAr: Staticize clk_frac_ops 2013-12-19 11:45:17 -08:00
st clk: st: Support for A9 MUX clocks 2014-03-25 15:59:23 -07:00
sunxi clk: sunxi: fix thinko in comment 2014-03-19 12:35:07 -07:00
tegra clk: tegra: remove non-existent clocks 2014-04-24 15:36:50 +02:00
ti == Changes to existing drivers == 2014-04-07 10:24:18 -07:00
ux500 clk: ux500: Staticize ux500_twocell_get 2014-02-23 15:04:40 -08:00
versatile clk: vexpress: NULL dereference on error path 2014-04-24 11:39:06 +01:00
x86 ACPI / LPSS: add support for Intel BayTrail 2013-06-19 01:08:47 +02:00
zynq The clock framework changes for 3.15 look similar to past pull requests. 2014-04-05 18:39:18 -07:00
clk-axi-clkgen.c clk: axi-clkgen: Add support for v2 2014-02-26 17:02:29 -08:00
clk-bcm2835.c ARM: bcm2835: remove custom .init_time hook 2013-09-29 21:09:24 +02:00
clk-composite.c clk: composite: pass mux_hw into determine_rate 2014-01-15 07:48:03 -08:00
clk-devres.c ARM: 7537/1: clk: Fix release in devm_clk_put() 2012-09-19 21:51:27 +01:00
clk-divider.c clk: divider: Fix best div calculation for power-of-two and table dividers 2014-04-30 11:44:00 -07:00
clk-efm32gg.c clk: new driver for efm32 SoC 2013-11-04 12:23:18 -08:00
clk-fixed-factor.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-11-15 16:47:22 -08:00
clk-fixed-rate.c clk: add accuracy support for fixed clock 2013-12-22 23:14:28 -08:00
clk-gate.c clk: wrap I/O access for improved portability 2013-08-27 17:50:38 -07:00
clk-highbank.c ARM: highbank: remove custom .init_time hook 2013-09-29 21:09:29 +02:00
clk-ls1x.c clk: add Loongson1B clock support 2012-08-31 11:05:18 -07:00
clk-max77686.c clk: max77686: Register OF clock provider 2014-01-08 09:57:07 -08:00
clk-moxart.c clk: add MOXA ART SoCs clock driver 2014-03-18 17:13:14 -07:00
clk-mux.c clk: wrap I/O access for improved portability 2013-08-27 17:50:38 -07:00
clk-nomadik.c clk: nomadik: fix multiplatform problem 2014-02-26 11:14:44 -08:00
clk-nspire.c clk: Add TI-Nspire clock drivers 2013-05-31 12:07:45 -07:00
clk-ppc-corenet.c clk: mpc85xx: Update the driver to align to new clock bindings 2014-03-19 17:04:14 -07:00
clk-s2mps11.c clk: s2mps11: Use of_get_child_by_name 2014-03-24 15:11:27 -07:00
clk-si570.c clk: si570: Remove redundant of_match_ptr helper 2013-12-22 22:46:52 -08:00
clk-si5351.c The second half of the clock framework pull requeust for 3.14 is 2014-01-28 18:44:53 -08:00
clk-si5351.h clk: si5351: remove variant from platform_data 2014-01-27 11:20:22 -08:00
clk-twl6040.c clk: use platform_{get,set}_drvdata() 2013-05-30 18:19:34 -07:00
clk-u300.c clk: u300: Fix incorrect placement of __initconst 2013-08-27 18:34:09 -07:00
clk-vt8500.c clk: vt8500: Staticize vtwm_pll_ops 2013-12-19 17:47:32 -08:00
clk-wm831x.c clk: wm831x: get rid of the implementation of remove function 2013-10-02 01:23:34 -07:00
clk-xgene.c clk: Add APM X-Gene SoC clock driver 2013-10-07 11:22:15 -07:00
clk.c clk: Fix double free due to devm_clk_register() 2014-04-30 11:44:04 -07:00
clk.h clk: Provide not locked variant of of_clk_get_from_provider() 2013-12-04 17:19:30 +01:00
clkdev.c clk: return probe defer when DT clock not yet ready 2014-02-24 17:14:56 -08:00
Kconfig The clock framework changes for 3.15 look similar to past pull requests. 2014-04-05 18:39:18 -07:00
Makefile The clock framework changes for 3.15 look similar to past pull requests. 2014-04-05 18:39:18 -07:00