From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1266A3112BD for ; Mon, 11 May 2026 09:40:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778492414; cv=none; b=CeZWWvZQbYMATGIipfXGVBFVE8kGqQkFFlEppNFmfNMf9S6XhbbKpaTdOcV1Ge6pB4+NN3X0isFWnf5fl9vhTL2Sqf4Mx0ZdJEs4m8hmmqwhJujhHUFiOPbATt5pQuzTaqEsIxiCbwybrsGQvwPJmVm/61p4hg25nO4T02jWisE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778492414; c=relaxed/simple; bh=Ot2eN4Rwr0wT4qQBvc2wpwtb/0xmY45GYo+XcTU/Kv0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=R1f5/7SOoxxy3qvUGEvcNEv2OJOg0Hqt12EeX8KGrwAwuW8747P49iQrZ2yftZxZFc/EjxlpVp3TuvUqetf0LhbXZdkv05J4BXTyMIzGOQnjQZ5AlXjZ94IpMh66Cye3VORxAZxTx3x0qktSo+TXhpCkxKjVNSfpBb4CwLAHQpw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=KgAHDhmD; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="KgAHDhmD" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 06B211477; Mon, 11 May 2026 02:40:07 -0700 (PDT) Received: from localhost (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C57DA3F85F; Mon, 11 May 2026 02:40:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1778492412; bh=Ot2eN4Rwr0wT4qQBvc2wpwtb/0xmY45GYo+XcTU/Kv0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KgAHDhmDzkrEYH0oU60KumIz3pBVMD04jJMgUhwTIt1NjUP1hS1/xWYR46Toxxtpm nuTXzSF/UyzLA65hANMUiJ7TqcL/VfAeooDfIGLlfA6FMmwt6BbMjD5kImxHSkc/BP tcn18giVR+s0uhwNCg2fP5N5MEpYpIqN/PKJ67CQ= Date: Mon, 11 May 2026 10:40:09 +0100 From: Leo Yan To: Jie Gan Cc: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Tingwei Zhang , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jie Gan Subject: Re: [PATCH] coresight: fix source not disabled on idr_alloc_u32 failure Message-ID: <20260511094009.GK3778514@e132581.arm.com> References: <20260511-fix-coresight-sysfs-enable-issue-v1-1-1b3829748171@oss.qualcomm.com> <20260511092446.GJ3778514@e132581.arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, May 11, 2026 at 05:28:37PM +0800, Jie Gan wrote: > 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 > > > > 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! Just note, I updated the Fixes tag as: Fixes: 5c0016d7b343 ("coresight: core: Use IDR for non-cpu bound sources' paths.") Which is the original patch for the issue. Thanks, Leo