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 3F97F367294 for ; Wed, 30 Sep 2026 02:25:26 +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=1790735127; cv=none; b=bMM5P0tHNh9OSNgKG8IfqO0Ftv14NtIOCkqDOXQtx7GS6JjGG6j3dgCruXJP2nVWM7eYZEykEAUQoqW8or59SWfzz5bA4igc9jfvaHuOglD/0kVMfNQfVMc4UEjY38bs3X2IjknVYbmP1XDB9+rj8CEGrWePCwkMsB3eBpk74UE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790735127; c=relaxed/simple; bh=NOjbHyQ1t9f4Hns/QwVSHdY6Xv32LpnKUSU+axkiZQc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xh27qGQ70vnyjpBjrgq3YsDv9ZMPlRDbO+KVkQp0NnwC0/STQqF26rcbnGZp7Uvc2hDmU9bafdPdk2OCOpj02gLkmAbUHooq9R0PLuwwgcGFc7K4/1O/T7iuOWGHv0PUhQNwaQwScV5Eq+0Y4kfYTpH9vELxqkRUU9FQL2O7IIw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=a1PmCdHP; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="a1PmCdHP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69E1D1F0089A; Wed, 30 Sep 2026 02:25:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790735125; bh=81SoaqpI+Z1AdOpi5Pws5MSosjNYHey5yU4BCre7iUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=a1PmCdHPa+Sx4ZdE/X6sVGTWrD7IkrsQjbFnzvcT/BcM0Uq/VTB7qBkl5833Hqfth 6r18h96RwD8KMiO6CNLiKaTatJGIl3Q5sHyYpdNzswKsdm9Dy96LzhDJIssvh1j3Wd dn0VC36U3w8Bu5sGDL4hyisHPdLp6+DdB49nxa3ATbrFzCmSPC5YjkYRgoo/7Biarh /uaph8v7bUf61cYoajOldUTKTpEwEPoUwgJi6pnj/3hF1FEYMPLINevDbnQJ6W5puw m/Sx/qXn2ULCIKPdHWd6kgjtlfRHTatLgCpP1jiRO7z58btVWyYfGRPc7SpZH0bZxu q1h7SbGc+0UlQ== From: Sasha Levin To: stable@vger.kernel.org Cc: Chen Changcheng , Jiri Kosina , Sasha Levin Subject: [PATCH 6.1.y 3/3] HID: alps: unregister DualPoint Stick input device on remove Date: Tue, 29 Sep 2026 22:25:22 -0400 Message-ID: <20260930022522.3389463-3-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260930022522.3389463-1-sashal@kernel.org> References: <2026092957-hanky-stipend-aaa1@gregkh> <20260930022522.3389463-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Chen Changcheng [ Upstream commit aa9dde93e05a837645fdfd577eea71f0733f0694 ] alps_input_configured() allocates a second input device ("DualPoint Stick") with input_allocate_device() and registers it, but the alps_driver struct has no .remove handler and input2 is not tracked in hdev->inputs. The default remove path (hid_hw_stop -> hidinput_disconnect) only iterates hdev->inputs, so input2 is never unregistered and leaks on every device removal. Add a .remove handler that stops the device first (preventing URB callbacks from touching input2 during teardown) and then unregisters input2. Fixes: 2562756dde55 ("HID: add Alps I2C HID Touchpad-Stick support") Cc: stable@vger.kernel.org Signed-off-by: Chen Changcheng Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-alps.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c index b2966c6598e18..73de6b04022cb 100644 --- a/drivers/hid/hid-alps.c +++ b/drivers/hid/hid-alps.c @@ -823,6 +823,24 @@ static int alps_probe(struct hid_device *hdev, const struct hid_device_id *id) return 0; } +static void alps_remove(struct hid_device *hdev) +{ + struct alps_dev *data = hid_get_drvdata(hdev); + + /* + * input2 ("DualPoint Stick") is allocated separately and is not + * tracked in hdev->inputs, so the default remove path + * (hid_hw_stop -> hidinput_disconnect) does not unregister it. + * + * Stop the device first so that no URB callback can touch input2 + * while it is being unregistered, then drop it explicitly. + */ + hid_hw_stop(hdev); + + if (data->input2) + input_unregister_device(data->input2); +} + static const struct hid_device_id alps_id[] = { { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1_DUAL) }, @@ -845,6 +863,7 @@ static struct hid_driver alps_driver = { .input_configured = alps_input_configured, .resume = pm_ptr(alps_post_resume), .reset_resume = pm_ptr(alps_post_reset), + .remove = alps_remove, }; module_hid_driver(alps_driver); -- 2.53.0