]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
intel_th: Fix error handling in intel_th_output_open
authorMa Ke <make24@iscas.ac.cn>
Wed, 12 Nov 2025 09:17:23 +0000 (17:17 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Jan 2026 11:57:14 +0000 (12:57 +0100)
commit4157f7bba6299d4288f95e935a01beba82ebffb5
treea34c8d9d6008126339e79023775cd947bbeecde7
parent1f53652922cd39d4547268f2962c24e1b7dfc8b0
intel_th: Fix error handling in intel_th_output_open

commit 6d5925b667e4ed9e77c8278cc215191d29454a3f upstream.

intel_th_output_open() calls bus_find_device_by_devt() which
internally increments the device reference count via get_device(), but
this reference is not properly released in several error paths. When
device driver is unavailable, file operations cannot be obtained, or
the driver's open method fails, the function returns without calling
put_device(), leading to a permanent device reference count leak. This
prevents the device from being properly released and could cause
resource exhaustion over time.

Found by code review.

Cc: stable <stable@kernel.org>
Fixes: 39f4034693b7 ("intel_th: Add driver infrastructure for Intel(R) Trace Hub devices")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Link: https://patch.msgid.link/20251112091723.35963-1-make24@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/intel_th/core.c