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 40756481247; Tue, 25 Aug 2026 13:37:14 +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=1787665035; cv=none; b=QsqGyHw/PCnpHLg08qeC7D7/ZyIH5f0vzGAQStcUwoi51rdpYDLERoDX1UCmFsz0JXkfewIYL/xjB4cgbv6PMBCXnY6Z7GQigz+YnQBeYDkV1AtIaXQDBxvTxL3qNYvYQJyhyhq8yPNwq8WTw9Q7i3kZ6uVswrkuc/7Llxyy8ss= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787665035; c=relaxed/simple; bh=K3oFKfB+liDajsTwwe8d8y5hrw+VIgOGWl2/6EOs/P4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J9VEuEGgerZ8J+hToewp7pKDd7GL+8G0VufWkCOjFuF0+yEYgBi1w6Pe368Kd1sWZReTGX/FLKrTOtzwQnATYtYYELH/OE8kZz5HhVcog26sq1WDGa6CHnbGTsaz61vONWFabVx44eleqHyP7KQ3Ok491l7eAHfo3Ye48Z9TnNY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ulIYa5An; 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="ulIYa5An" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62C551F00A3A; Tue, 25 Aug 2026 13:37:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787665034; bh=0IWrNTa+Mw2Uxxio0Ji3eNNR9fBl9vVKwsEXLPKbHBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ulIYa5An7A+ua6O8pguua2bOFh2GWPIuInStwEQirR11M9I3JptFwLsc6oztczj14 KKe1N9XRgB383wTnR8RDO6OxevtotwQP0Xzmb7fI7oexhTbfYtFUcq8GXYYo+U+kjA u1rM6pEgGwFb5TTOSCV5NG05SLw8aAdR7ONcTDw4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, sashiko-bot@kernel.org, Jiangshan Yi , Jiri Kosina Subject: [PATCH 7.1 085/101] HID: nintendo: register input device after capabilities are set Date: Tue, 25 Aug 2026 15:26:03 +0200 Message-ID: <20260825132545.234275283@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260825132541.986300899@linuxfoundation.org> References: <20260825132541.986300899@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 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiangshan Yi commit d723bc1fe2e72b9252234e94c11af644ec477bf7 upstream. input_register_device() exposes the device to userspace immediately. In joycon_input_create() it was called before joycon_config_rumble() configures the FF_RUMBLE capability and the memless force-feedback device, so a concurrent EVIOCSFF could dereference a NULL dev->ff. Registering early also means the initial udev event lacks button and axis information, which can make input managers ignore the device. Move input_register_device() to the end of joycon_input_create(), after all capabilities, the IMU input device and the force-feedback callbacks have been configured. Fixes: 2af16c1f846b ("HID: nintendo: add nintendo switch controller driver") Reported-by: sashiko-bot@kernel.org Closes: https://sashiko.dev/#/patchset/20260730031927.25444-1-yijiangshan@kylinos.cn?part=1 Cc: stable@vger.kernel.org Signed-off-by: Jiangshan Yi Link: https://sashiko.dev/#/patchset/20260730031927.25444-1-yijiangshan@kylinos.cn?part=1 Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-nintendo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/hid/hid-nintendo.c +++ b/drivers/hid/hid-nintendo.c @@ -2138,10 +2138,6 @@ static int joycon_input_create(struct jo ctlr->input->phys = hdev->phys; input_set_drvdata(ctlr->input, ctlr); - ret = input_register_device(ctlr->input); - if (ret) - return ret; - if (joycon_type_is_right_joycon(ctlr)) { joycon_config_right_stick(ctlr->input); joycon_config_buttons(ctlr->input, right_joycon_button_mappings); @@ -2181,6 +2177,10 @@ static int joycon_input_create(struct jo if (joycon_has_rumble(ctlr)) joycon_config_rumble(ctlr); + ret = input_register_device(ctlr->input); + if (ret) + return ret; + return 0; }