]> git.ipfire.org Git - thirdparty/linux.git/commit
coresight: Fixes device's owner field for registered using coresight_init_driver()
authorJunhao He <hejunhao3@huawei.com>
Wed, 18 Sep 2024 03:53:27 +0000 (11:53 +0800)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Tue, 29 Apr 2025 17:47:37 +0000 (18:47 +0100)
commit9f52aecc952ddf307571517d5c91136c8c4e87c9
treefbc80957ddfde9b1ff1835605a207be3de4c89ef
parent9c32cda43eb78f78c73aee4aa344b777714e259b
coresight: Fixes device's owner field for registered using coresight_init_driver()

The coresight_init_driver() of the coresight-core module is called from
the sub coresgiht device (such as tmc/stm/funnle/...) module. It calls
amba_driver_register() and Platform_driver_register(), which are macro
functions that use the coresight-core's module to initialize the caller's
owner field.  Therefore, when the sub coresight device calls
coresight_init_driver(), an incorrect THIS_MODULE value is captured.

The sub coesgiht modules can be removed while their callbacks are
running, resulting in a general protection failure.

Add module parameter to coresight_init_driver() so can be called
with the module of the callback.

Fixes: 075b7cd7ad7d ("coresight: Add helpers registering/removing both AMBA and platform drivers")
Signed-off-by: Junhao He <hejunhao3@huawei.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20240918035327.9710-1-hejunhao3@huawei.com
drivers/hwtracing/coresight/coresight-catu.c
drivers/hwtracing/coresight/coresight-core.c
drivers/hwtracing/coresight/coresight-cpu-debug.c
drivers/hwtracing/coresight/coresight-funnel.c
drivers/hwtracing/coresight/coresight-replicator.c
drivers/hwtracing/coresight/coresight-stm.c
drivers/hwtracing/coresight/coresight-tmc-core.c
drivers/hwtracing/coresight/coresight-tpiu.c
include/linux/coresight.h