]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
perf: arm_cspmu: fix error handling in arm_cspmu_impl_unregister()
authorMa Ke <make24@iscas.ac.cn>
Wed, 22 Oct 2025 11:53:25 +0000 (19:53 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Jan 2026 11:57:07 +0000 (12:57 +0100)
commit0eeaa2ba3b43cc7b0608b6e467ed9ff0ae527847
treebb9ae3a14ddb5d960ab5653f303d31e28276592f
parentbacecf370e0cca03bd45a4f4bfc500be3a37bd35
perf: arm_cspmu: fix error handling in arm_cspmu_impl_unregister()

commit 970e1e41805f0bd49dc234330a9390f4708d097d upstream.

driver_find_device() calls get_device() to increment the reference
count once a matching device is found. device_release_driver()
releases the driver, but it does not decrease the reference count that
was incremented by driver_find_device(). At the end of the loop, there
is no put_device() to balance the reference count. To avoid reference
count leakage, add put_device() to decrease the reference count.

Found by code review.

Cc: stable@vger.kernel.org
Fixes: bfc653aa89cb ("perf: arm_cspmu: Separate Arm and vendor module")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/perf/arm_cspmu/arm_cspmu.c