]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
coresight: trbe: Return NULL pointer for allocation failures
authorLeo Yan <leo.yan@arm.com>
Thu, 4 Sep 2025 14:13:52 +0000 (15:13 +0100)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Tue, 23 Sep 2025 13:14:13 +0000 (14:14 +0100)
commit8a55c161f7f9c1aa1c70611b39830d51c83ef36d
tree1ee91cd033d3a23554f05c610c53c79271404ae4
parentdc783892cca69e721f81d54293dac6286134abfe
coresight: trbe: Return NULL pointer for allocation failures

When the TRBE driver fails to allocate a buffer, it currently returns
the error code "-ENOMEM". However, the caller etm_setup_aux() only
checks for a NULL pointer, so it misses the error. As a result, the
driver continues and eventually causes a kernel panic.

Fix this by returning a NULL pointer from arm_trbe_alloc_buffer() on
allocation failures. This allows that the callers can properly handle
the failure.

Fixes: 3fbf7f011f24 ("coresight: sink: Add TRBE driver")
Reported-by: Tamas Zsoldos <tamas.zsoldos@arm.com>
Signed-off-by: Leo Yan <leo.yan@arm.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/20250904-cs_etm_auxsetup_fix_error_handling-v2-1-a502d0bafb95@arm.com
drivers/hwtracing/coresight/coresight-trbe.c