[PATCH v2 5/6] clk: mediatek: mt8173: fix memory leak on module removal

Brian Masney bmasney at redhat.com
Tue Jul 7 07:48:24 PDT 2026


On Tue, Jul 07, 2026 at 04:48:34PM +0900, Akari Tsuyukusa wrote:
> clk-mt8173-apmixedsys.c and clk-mt8173-infracfg.c do not call
> platform_set_drvdata() during their driver probe callback,
> but their remove callback calls platform_get_drvdata().
> This results in platform_get_drvdata() returning NULL,
> which leads to calling kfree(NULL) in mtk_free_clk_data(NULL).
> This leaves clk_data unreleased, causing a memory leak.
> 
> Fix this by calling platform_set_drvdata() during probe.
> 
> Fixes: 4c02c9af3cb9 ("clk: mediatek: mt8173: Break down clock drivers and allow module build")
> Cc: stable at vger.kernel.org
> Signed-off-by: Akari Tsuyukusa <akkun11.open at gmail.com>

Reviewed-by: Brian Masney <bmasney at redhat.com>




More information about the linux-arm-kernel mailing list