From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B667022D792; Mon, 16 Feb 2026 07:54:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771228480; cv=none; b=LSgRjQuJdvm8Nr9legorC+NsydPaEhUPIo6RjhljEKoTsBAHUyruXNpggjqQawKSvsxf+e4ZOyXAb8cYhWueg04n414DI+5iL/F/MALkqLFu1Pvh4vIJGmU1/mzczSbYGe5OwIqZrx+Nn1YGZN22dMTT0CIe6Y1gdeFrslx7KiA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771228480; c=relaxed/simple; bh=XeF+58jMPV7rbzYLcofkZ2ZERolCjjHDECcyxEkot+A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=G1RmjW9HiyuOZlI/fafWBX1q1UzKgNvZAsGuL8NeJIKNzTDq/RXPR1aMr+DzlB1HybtXJ3W2CAZ9Cy+AY+ontp6p3P3rlaY6K6mFcbiHoyil+QDf6jNRTLlGeu/L/UgDXWP0XjD2dZmVAn4L+TcpktGShl+sNjiyzim6sYMNp20= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PADWuTug; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PADWuTug" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F478C116C6; Mon, 16 Feb 2026 07:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771228480; bh=XeF+58jMPV7rbzYLcofkZ2ZERolCjjHDECcyxEkot+A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PADWuTugiNH14cIPsDO2zFzrWZcT9pYit4dFg3N2ZIGTkI9N2UmNAHTvucWyiHhT9 d+VBuQuIfTwg2vLICme5LMjisU6anCviHYw0B3qBiO5vYkfIi6CkLU516dAA7nVDCB vSYTx9iIVKXhF5Fn03R/EE0Q9r1Ufewn9ClfVO3M5s2Ef2vL0xDHSrM/MFkzEx1W2F D2+HXC25ViAgTB0Bw366neH14gnrvZnDzLa1YRarmXLq4m3nsCYklpJiedeqUzDCh1 Yd2bi90n5g9hV765k7dhG+mdLtRFcFQe93mmhyFZfWM/WUbqYmGSG2kioKqqLI4gsp EUWEn60BDAYuA== Received: from johan by rho.lan with local (Exim 4.98.2) (envelope-from ) id 1vrtRD-000000002qh-3Btc; Mon, 16 Feb 2026 08:54:35 +0100 Date: Mon, 16 Feb 2026 08:54:35 +0100 From: Johan Hovold To: Bartosz Golaszewski Cc: Bartosz Golaszewski , Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] gpio: sysfs: fix chip removal with GPIOs exported over sysfs Message-ID: References: <20260212133505.81516-1-bartosz.golaszewski@oss.qualcomm.com> Precedence: bulk X-Mailing-List: stable@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 Fri, Feb 13, 2026 at 10:11:47AM -0800, Bartosz Golaszewski wrote: > On Fri, 13 Feb 2026 09:32:47 +0100, Johan Hovold said: > > On Thu, Feb 12, 2026 at 02:35:05PM +0100, Bartosz Golaszewski wrote: > >> Currently if we export a GPIO over sysfs and unbind the parent GPIO > >> controller, the exported attribute will remain under /sys/class/gpio > >> because once we remove the parent device, we can no longer associate the > >> descriptor with it in gpiod_unexport() and never drop the final > >> reference. > > > > Is this a recent regression? I'm quite sure fixed this once back in > > 2015. > > Yes, that sometimes happens. There have been close to 100 commits between your > fix and now, including two major reworks. It sure does. I was just pointing out that this is a regression, which wasn't apparent from your commit message. > >> Rework the teardown code: provide an unlocked variant of > >> gpiod_unexport() and remove all exported GPIOs with the sysfs_lock taken > >> before unregistering the parent device itself. This is done to prevent > >> any new exports happening before we unregister the device completely. > > > > So please add a Fixes tag here to document this. > > > >> Cc: stable@vger.kernel.org > >> Signed-off-by: Bartosz Golaszewski > It bisects to this commit, though it's possible it's a mix of several changes. > > Fixes: 1cd53df733c2 ("gpio: sysfs: don't look up exported lines as > class devices") That's the commit from last summer that I suspected as well after a quick glance at the code (hence the word "recent" above). We don't want anyone trying to backport this further back than needed. Johan