[PATCH] coresight: fix source not disabled on idr_alloc_u32 failure

Jie Gan jie.gan at oss.qualcomm.com
Mon May 11 02:28:37 PDT 2026


Hi Leo,

On 5/11/2026 5:24 PM, Leo Yan wrote:
> On Mon, May 11, 2026 at 05:04:44PM +0800, Jie Gan wrote:
>> In coresight_enable_sysfs(), for non-CPU sources (SOFTWARE, TPDM,
>> OTHERS), the source device is enabled via coresight_enable_source_sysfs()
>> before idr_alloc_u32() maps the path. If idr_alloc_u32() fails, the
>> original code jumped directly to err_source, which only calls
>> coresight_disable_path() and coresight_release_path(). The source device
>> was left enabled with an incremented refcnt but no path tracked for it,
>> leaving the device in an inconsistent state.
>>
>> Disable the source before jumping to err_source so the enable and path
>> operations are fully unwound.
>>
>> Fixes: 1f5149c7751c ("coresight: Move all sysfs code to sysfs file")
>> Signed-off-by: Jie Gan <quic_jiegan at quicinc.com>
> 
> Actually I have noticed this. Since my PM series will remove IDR things,
> and I don't think anyone really hit idr alloc error, this is why I
> didn't send fix for this.
> 
> Anyway, this is a reasonable fix. I will send out my PM series later
> in today, I will pick this patch into my series and rebase on it, hope
> this is easier for all of us.

Well noted. Please feel free to pick it into your series.

Thanks,
Jie

> 
> Thanks,
> Leo




More information about the linux-arm-kernel mailing list