From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 38DAD3911A9; Sat, 17 Oct 2026 17:06:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792256780; cv=none; b=T6Vr3z3W6LIomohGWcpWXKAhM8VOSkqr/qGkM3nfDNec0j/y/NaGJpPGjVNqyHefaeqLL5CDDoPOARb1n4EmsdQ1TOwdUE3GtEbJB8EZrecTXSfxI79YNH+ArdRU+ucjGwS81ZFpgLXtGV0caMWtFZZvxZJ3kgTFfg9Fg7Pla5I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792256780; c=relaxed/simple; bh=Cxs9bxPEHV0T7dmqCcSXiyjbSy1TAlPusFd3smq8rwQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JBaMezjhmuVvIhCKirEfGDh6EKfB3tzLz0+fLafQE9HWuLczHwpMz1+/Iqz/LK+q5iuAWmery9WDDzMuoqQHjXna2C5YES0eY4g6Ods0i3M3MHHLiRVD4a2YdyjvKFz/Hfju3G2HC+vQuNzapIbseH5MlUvVsRRVQnmcaPzCbSA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Eirr6mXo; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Eirr6mXo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9402B1F000C4; Sat, 17 Oct 2026 17:06:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792256779; bh=6zDgjgjG03psvvBQLqiF+SDsHLVGZQNEr8MNju/Z/Qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Eirr6mXoZwmjrGK/BePoOJ7vfRngKCaqWKEmn6Q+siNCD9Pg+svr3dp1imznKIV/x TQs914kKTFYsKXgDPFoX/UM/6VpFAWzYf8znWgRe907ErEcScfjT6OM4k40magLXcT W28y6+6d+ab9t2wkmS+9g9bazqy6CBCLcHarrY78= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Cong Nguyen , Jonathan Cameron Subject: [PATCH 6.6 0350/1674] iio: proximity: pulsedlight: fix iio_device left registered on PM setup failure Date: Sat, 17 Oct 2026 17:43:42 +0200 Message-ID: <20261017160440.110937751@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Cong Nguyen commit 4daa9ca557b4b98ae1ad38a6d1deaa3e31eb8edf upstream. pm_runtime_set_active() failing in probe() jumps to error_unreg_buffer, which only calls iio_triggered_buffer_cleanup() -- it does not undo the iio_device_register() that already succeeded a few lines above. probe() then returns the error, the devm-managed indio_dev is freed, but the iio core still has it registered: the sysfs/chardev nodes stay live and point at freed memory. Add an error_unreg_dev label that unregisters the iio device before falling through to the existing buffer cleanup, mirroring the teardown order already used in lidar_remove(). Fixes: 4ac4e086fd8c ("iio: pulsedlight-lidar-lite: add runtime PM") Assisted-by: Claude:claude-opus-4 Signed-off-by: Cong Nguyen Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c @@ -298,12 +298,14 @@ static int lidar_probe(struct i2c_client ret = pm_runtime_set_active(&client->dev); if (ret) - goto error_unreg_buffer; + goto error_unreg_dev; pm_runtime_enable(&client->dev); pm_runtime_idle(&client->dev); return 0; +error_unreg_dev: + iio_device_unregister(indio_dev); error_unreg_buffer: iio_triggered_buffer_cleanup(indio_dev);