summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJie Gan <jie.gan@oss.qualcomm.com>2026-05-11 12:19:18 +0800
committerSuzuki K Poulose <suzuki.poulose@arm.com>2026-05-19 14:24:55 +0100
commit1563ae33dc4f5ebac96b93af2ef72e72aaaa31ae (patch)
tree519bfa4fbaccb658b13d93e7c6b5fcc2419b1fdb /scripts
parenta5dd853fb7774c9543aed272a8614c15ebce3173 (diff)
coresight: platform: defer connection counter increment until alloc succeeds
coresight_add_out_conn() increments nr_outconns before calling devm_krealloc_array() and again before devm_kmalloc(). If either allocation fails, the counter is already bumped while the corresponding array entry is NULL or uninitialized garbage. coresight_add_in_conn() has the same problem with nr_inconns and devm_krealloc_array(). In both cases the probe returns -ENOMEM, which causes coresight_get_platform_data() to call coresight_release_platform_data() for cleanup. That function iterates up to nr_outconns (or nr_inconns) entries and dereferences each pointer unconditionally, hitting the NULL or garbage entry and panicking instead of failing gracefully. Fix by moving the counter increments to after all allocations succeed, so the struct is always consistent on any error path. Fixes: 3d4ff657e454 ("coresight: Dynamically add connections") Fixes: e3f4e68797a9 ("coresight: Store in-connections as well as out-connections") Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com> Reviewed-by: James Clark <james.clark@linaro.org> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/20260511-fix-ref-count-issue-v1-1-99d647810d3c@oss.qualcomm.com
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions