From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796383422; b=asC5BfrM9cJh/NZSCh9Od8OUUxqtAEOkTVYQyoztx/srPchtKgonGn/TDmpCZPqu4Rr2 wJxsY9rRHU016NrhkySAeHm2b5gl7ZNiOaIX/f95cSZFXooZJonIMZhlM5wvl5yGozcbS MMWNEbn2pZcloQeTqocj29MrEH7rpRgJvhrhfczm3D84TdOqrVwKi7Z2BSb0ZARoXrTWZ 4Y4e9LV8dY5wUsO8jHa5Nh0kvZqC9MlK0KBXnDrYJLUnkq1U9mJcFnbLKZ2Ht3Z9jVtxk IsN2NJvrp2gsFrTKjihMrsj9keCGKHy7E3+vwtrC8RtXBkPBP1TFSWQVOHO4jXfKTig== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383422; 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-Transfer-Encoding; bh=94O2hSNab+DCLkQwdZjo1xrHrG/OxS9aXYVU51r9ODo=; b=RRu7d48SSrS1rzWS9HA6R38HOecVKdsYXxUsk+u7HwJQFWg/oAJ2smZfx/0ugU4suLHA krEAWgA40BZYzoRBa73d4SVSvAVineQkc6eGPOPCGLTW0W5KFP8KxwZJUwKXkzBBVvdFf WUFwvv0MbWKViMBequkEWIMrdn3tA/TXTYx5Fb5RpYAmrKkF6njq5/glEmRG1K+A+KJO+ bvnwbhoPsX44w3uMWRDu+HCLCbq7ftdItKcG0HSUfJTzwZudaxeG466IIFEsQKWwWNtt/ E+TSIZL8jdxKJknFV5kcLRO3R7Uz227439DZD37GA6rdnoC9g39c5rfR+bvjEskaGRQ== 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=tFfd6gzI; 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 E4C29606A32D; Fri, 4 Dec 2026 11:23:41 +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=tFfd6gzI Received: by smtp.kernel.org (Postfix) with ESMTPSA id 339AB1F000CE; Fri, 4 Dec 2026 11:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383421; bh=94O2hSNab+DCLkQwdZjo1xrHrG/OxS9aXYVU51r9ODo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=tFfd6gzIt3yzXWYhdSYlxFhRtv5JunlQwNh+3e53B0Vl9J57rI+Z5Ppkqe3bcBt3n WTh3DsOjmSjWdB+1vGLHTCAxiTBOmP0Qy99T6GGSIEDAPJfLpBDK8m+VAKcYHQvauq 3/WlmpAibajeot2Kv275D4mJ4tyYFxlByuAw9Gq4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Semyon Maryasin , Zhang Lixu , Srinivas Pandruvada , Jonathan Cameron , Jiri Kosina , Sasha Levin Subject: [PATCH 6.12 218/555] HID: sensor: custom: Register enable attribute after misc device Date: Fri, 4 Dec 2026 19:04:21 +0900 Message-ID: <20261204100617.309673086@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Srinivas Pandruvada [ Upstream commit c6ebe27e3ba09edf956139c741b38e8432be3f67 ] Register the enable_sensor sysfs group only after misc-device setup succeeds. This prevents userspace from opening the sensor hub while probe can still fail, which would otherwise leave the hub open reference unbalanced on unwind. Fixes: 4a7de0519df5 ("HID: sensor: Custom and Generic sensor support") Reported-by: Semyon Maryasin Closes: https://lore.kernel.org/all/CAM2dg7ewfVJSP4rFyhkCB1Rmd1+X56sAg=eUdbPthG2xrLqwQQ@mail.gmail.com/ Tested-by: Semyon Maryasin Tested-by: Zhang Lixu Signed-off-by: Srinivas Pandruvada Reviewed-by: Jonathan Cameron Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-sensor-custom.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c index 88a8918edf4b1..e5f2318183149 100644 --- a/drivers/hid/hid-sensor-custom.c +++ b/drivers/hid/hid-sensor-custom.c @@ -1059,20 +1059,19 @@ static int hid_sensor_custom_probe(struct platform_device *pdev) if (ret) goto err_remove_callback; - ret = sysfs_create_group(&sensor_inst->pdev->dev.kobj, - &enable_sensor_attr_group); + ret = hid_sensor_custom_dev_if_add(sensor_inst); if (ret) goto err_remove_attributes; - ret = hid_sensor_custom_dev_if_add(sensor_inst); + ret = sysfs_create_group(&sensor_inst->pdev->dev.kobj, + &enable_sensor_attr_group); if (ret) - goto err_remove_group; + goto err_remove_dev_if; return 0; -err_remove_group: - sysfs_remove_group(&sensor_inst->pdev->dev.kobj, - &enable_sensor_attr_group); +err_remove_dev_if: + hid_sensor_custom_dev_if_remove(sensor_inst); err_remove_attributes: hid_sensor_custom_remove_attributes(sensor_inst); err_remove_callback: -- 2.53.0