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 DF8571D5CE0 for ; Mon, 11 May 2026 09:24:49 +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=1778491491; cv=none; b=Th6k6pTWoOXHbepiHEZqsruYYN/1yucOokbq5jCOfan9TiT7JALfVWzA6Yrbivtr7iUQaj+87Ge+Curmmou85CVLdthQp4gXGqwsSV/gbS+muihQrYnd7qPTW4UhhvYDsRbO4xQFALogsIjv32DgVM/5wiHx6I03PJ555xN8vGM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778491491; c=relaxed/simple; bh=R//K3qLvK1Hfgvo+iGgdU2zldTl+EG+2tAuWFGUz9WA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sxWMVAR4gXuCCoq+SN8ZrC1P69qDYkUPNdE5i5kjpUfw0tgX3wwKVIIwUbbfrfPybQcUOd3CibW9hgVMTbLHo8qTtJ5vrfXjFNL76+dXrRg0V7asl50fMe0mVdGTkrySZFkoAm0Lj/BJpYUOFP6PLVsTC51Xsy8xuO3kGdSwjc4= 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=tGyuMtV4; 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="tGyuMtV4" 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 D81A616F8; Mon, 11 May 2026 02:24:43 -0700 (PDT) Received: from localhost (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B87A13F85F; Mon, 11 May 2026 02:24:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1778491489; bh=R//K3qLvK1Hfgvo+iGgdU2zldTl+EG+2tAuWFGUz9WA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tGyuMtV4ZwcQjQc0zCS1sZcGEReqwT5fdoqx3fZ0jAWci4+05uIVpbuEf2Q2R19Tp Eqct+KBIPh37kk1OnzuU4jTUk2SoeUq5XyXoiQj2hIU1ksZy5D4StBwsXYygS5v90C LO2eJIQN33YNm7zHCHpBgkKuToK74I6DwzQhNwm8= Date: Mon, 11 May 2026 10:24:46 +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: <20260511092446.GJ3778514@e132581.arm.com> References: <20260511-fix-coresight-sysfs-enable-issue-v1-1-1b3829748171@oss.qualcomm.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: <20260511-fix-coresight-sysfs-enable-issue-v1-1-1b3829748171@oss.qualcomm.com> 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. Thanks, Leo