Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795027644; b=n67wT53DTiScXIlOlCUNSqdD/WAOrsDT04YlkffKoI/nscCN/zdP3Pdvm8CiKOQ0FVrH DjbfhY17tVVQJyGPaDKyJZ7hb9oo2Csh+QZDl9nsEgqYFhIMg+GNcH2qDkHTUsQsrwbt8 KRizCMq/UlVDqThVnpybdMRuarF3q1N+dWnlJ9FkCjpNGgY754hDBBtmoIZ5g0tvpyxpd aAXZI/kDjfWFU3ZgzA84CIPrrS6340KInfFTmSbtCUMTGRHUogutBEH5jd1+jBSB/09/1 8bwKxXhWYv/1h2c8egASNiZQKBcKyOk9gZpnSm7aP7bjilZZXMtss3ZXubyXfWMKh/g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795027644; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=NsToO2VCAFy+OIy7WP7slNgJrOiQjL9Rv/v/Fvs3ZvE=; b=AU/uGSLV6SY8grHgyFNQfSqdpjTfq94wNOqdwwsRnvBGeI+K2b9j6edIUC3dA/w1udSW acLMzz/j5WPm7/IbWvspxy31Whr/ZPCNX/2miGP4FylkotGjA7SZtpmpIi2UY1Rjj30+l +zhNj6XkjzEMWXesGNXeNOWD+xS75d9X9V1IRNYUmDoTgRQJlAerSiiBhJDyA5RD3mBDc VvnUUH5JpX7nahWdhoHxFH1ALot2rGid6v36frpAcDwGInOXj1QhGc6+4YnF00MDvfsqa Tq8CqoDUKbsdltLBfSAXyfrwZXvdS+C7BChCgTTvfS7GtWK0zrdNAvYevUx/vvre73Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=qZo7mkNb; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05DEA606A333; Wed, 18 Nov 2026 18:47:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=qZo7mkNb Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22AE01F000C4; Wed, 18 Nov 2026 18:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795027643; bh=NsToO2VCAFy+OIy7WP7slNgJrOiQjL9Rv/v/Fvs3ZvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qZo7mkNb/gOF1pMY2W9vJbEfXcL46/TEGiyYm/prh7HVkwZOJSBeB/lRaLme7GGh4 /OdJbzV64R5vmgeEc2O2vRYiZazp+ck0cbXP+yBN46hdksGYRzHRFbYzz6r4lYRYl0 Dk7kA9HiHG/UANYY29UpASksn7501hykTYjbauSs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ijae Kim , Myeonghun Pak , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sasha Levin Subject: [PATCH 6.18 1825/2151] platform/x86: gpd pocket fan: Cancel work before releasing GPIOs Date: Wed, 18 Nov 2026 15:59:20 +0100 Message-ID: <20261118150228.288192196@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150121.603863898@linuxfoundation.org> References: <20261118150121.603863898@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Myeonghun Pak [ Upstream commit 9962770049c715fc30a7b3274d8f245167c0a410 ] The fan worker changes the direction of both GPIOs and schedules its next run. Its managed cancellation action is registered before the GPIOs are acquired, so devres releases the GPIOs before cancelling the work. A running worker can therefore change a GPIO after the driver has released it. Register the work cancellation action after both GPIO acquisitions. This makes devres cancel and drain the worker before releasing either GPIO. No work has been queued yet if GPIO acquisition or action registration fails. This issue was identified as part of our ongoing research while reviewing kernel code. Fixes: b82a7b018b93 ("platform/x86: gpd pocket fan: Clean-up by using managed work init") Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak Link: https://patch.msgid.link/179229442299.3956787.17526066623947466315.gpd-pocket-fan@gmail.com Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen Signed-off-by: Sasha Levin --- drivers/platform/x86/gpd-pocket-fan.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/gpd-pocket-fan.c b/drivers/platform/x86/gpd-pocket-fan.c index 7a20f68ae2061..01f9676fc0f43 100644 --- a/drivers/platform/x86/gpd-pocket-fan.c +++ b/drivers/platform/x86/gpd-pocket-fan.c @@ -153,10 +153,6 @@ static int gpd_pocket_fan_probe(struct platform_device *pdev) return -ENOMEM; fan->dev = &pdev->dev; - ret = devm_delayed_work_autocancel(&pdev->dev, &fan->work, - gpd_pocket_fan_worker); - if (ret) - return ret; /* Note this returns a "weak" reference which we don't need to free */ fan->dts0 = thermal_zone_get_zone_by_name("soc_dts0"); @@ -175,6 +171,11 @@ static int gpd_pocket_fan_probe(struct platform_device *pdev) if (IS_ERR(fan->gpio1)) return PTR_ERR(fan->gpio1); + ret = devm_delayed_work_autocancel(&pdev->dev, &fan->work, + gpd_pocket_fan_worker); + if (ret) + return ret; + gpd_pocket_fan_force_update(fan); platform_set_drvdata(pdev, fan); -- 2.53.0