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=1796381853; b=UigxGsZZos50FR09lZBBKA9BQKum8BHjTzScFyWt2D/7vpVJioL++x7Rc0WI9yMyuFXR P3q33SDKyGEyXRAqpq8kFeknks6qKPoO5izkzjgz+6KxilZ99SFTIIdiIhzKvtFIn4ixw cIsnMstkEN+EDRgSMEXfoGwtgU3RPgoYBmp04fElVUBOFjP+u/fVrSYmgNKHpW40VuTjI mBhsISJKieBOSI2gd8pf07u/2ULpa7YnbPgq/N3wzfVf/mgd6C2fU0ep6oB6gUK+HHJDc q0+HugHKqUnk97TvPI0YIieKIEXk1TO116Xa2sKhgVqD0o4GDpOwuUr2HipVt+dIMfA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381853; 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=2bEmNzQe9KLCzDEAwQcekDn+6CJPZPdt1DwhVHGmLuE=; b=1KmZvgsk8ybnET9YBmPmWLEwb2cgE4WD20b+46LWY5wxLDKvo0RwtfeddrdFkI/gjVuO m7DNNyr56UB1v+VLrENzAtYkgP27EL4N7HDaxnym01VJut2WGja4zEVtHGG8IbyZhA1aZ yG09YF+7mpCp40II5L7cmwYn+N1X6W+mB/vss86iV5LM2s7BToZoEg1Rc8CLzxFeBJjSy yHs5IwA9pnakdFS0GDUIbGazsHhTYDVfx2/o4TW6YY3lhG3HanGP01g86cdTC4rvW0zmJ ftc4ftsCMYiizM1sSjf7bEq393IduSccWLqnjUM+FLtr0YthQ6Lsp6Nn8quhg10IKnA== 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=BLGKeBZf; 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 5EEE5606A32F; Fri, 4 Dec 2026 10:57:33 +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=BLGKeBZf Received: by smtp.kernel.org (Postfix) with ESMTPSA id D36501F00897; Fri, 4 Dec 2026 10:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381853; bh=2bEmNzQe9KLCzDEAwQcekDn+6CJPZPdt1DwhVHGmLuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BLGKeBZfZl0irD1ovlbgascE1HjRo1t1P3mTgjR7cYNyyHtIojTUTwKyRjnxUnfLZ RIb7Nf/TN4sqZ2PvTi8ZzBDFtNquLWY7Xv3gpbkiMnTknwL6fuN6JQId+5cY0EWsYq vlkpBEFngHnSyPobr1hGR7GS/cQypGXULsjh7My0= 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.18 203/703] HID: sensor: custom: Register enable attribute after misc device Date: Fri, 4 Dec 2026 19:01:42 +0900 Message-ID: <20261204100633.252992161@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-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 0dea0bf059807..ef311a677521e 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