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 2AE8A36405A; Wed, 20 May 2026 17:36:10 +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=1779298571; cv=none; b=AkuDaRMInVp48ZLI/6NzDdlFMAcMa57qPoeZYSadFkVJDM4RMd787WiQPXPcvUItxyv/yH3eRwypH4th8fR4/mItp22GotUTURd0txmPnE531clnHPaxuBfFe5cjLRxs5y+hOAHWkdlH8qzU2OObvUsmkqGmSYQiak6W6uH1Jmw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779298571; c=relaxed/simple; bh=OmislN2xC8IPDbunB6iwlnLCsyVH45wLjBZHyKMVeYs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Kqn8mQTlVX9pxS26aNDyPUiawIwp3jE+agSb2MUGirV6bhTZbUprK9a9HgbUERongAGdt/U24dxoOyUi+/ZoZd364XXsYWWTZ5Eq2HhpRC33/OEa677Lw6YV1iKpVkYaS/sOWV6HYMb1se12np4Yiu4Ejl1w7vRw4fGS8qkzYGw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hZYTY6bz; 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="hZYTY6bz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90BB91F000E9; Wed, 20 May 2026 17:36:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779298570; bh=g3cEXKdQ5rTuwc2Yavbuw6ttaR3GgEGVXC/yWLu816E=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hZYTY6bzUTV86meAXbtui1GPZEYQjnobLjLtLDMHX0/eLL1vhwILgoRnn74CaQ7Hd AyahpM1ZYG65DOKmGdPcqw8aBBkOmhatS0yEnvCztfOEKFI+nn1x1pEDqnsBwyylY6 G6Aku13WEDI/OQwuwvF2WesFaBrfZuiaG/2B1PNo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Denis Benato , Jiri Kosina , Sasha Levin Subject: [PATCH 6.18 461/957] HID: asus: do not abort probe when not necessary Date: Wed, 20 May 2026 18:15:44 +0200 Message-ID: <20260520162144.520311684@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162134.554764788@linuxfoundation.org> References: <20260520162134.554764788@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Denis Benato [ Upstream commit 7253091766ded0fd81fe8d8be9b8b835495b06e8 ] In order to avoid dereferencing a NULL pointer asus_probe is aborted early and control of some asus devices is transferred over hid-generic after erroring out even when such NULL dereference cannot happen: only early abort when the NULL dereference can happen. Also make the code shorter and more adherent to coding standards removing square brackets enclosing single-line if-else statements. Fixes: d3af6ca9a8c3 ("HID: asus: fix UAF via HID_CLAIMED_INPUT validation") Signed-off-by: Denis Benato Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-asus.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index b9dfb38b0df4f..1746e8ea50ddf 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -1223,22 +1223,17 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) * were freed during registration due to no usages being mapped, * leaving drvdata->input pointing to freed memory. */ - if (!drvdata->input || !(hdev->claimed & HID_CLAIMED_INPUT)) { - hid_err(hdev, "Asus input not registered\n"); - ret = -ENOMEM; - goto err_stop_hw; - } - - if (drvdata->tp) { - drvdata->input->name = "Asus TouchPad"; - } else { - drvdata->input->name = "Asus Keyboard"; - } + if (drvdata->input && (hdev->claimed & HID_CLAIMED_INPUT)) { + if (drvdata->tp) + drvdata->input->name = "Asus TouchPad"; + else + drvdata->input->name = "Asus Keyboard"; - if (drvdata->tp) { - ret = asus_start_multitouch(hdev); - if (ret) - goto err_stop_hw; + if (drvdata->tp) { + ret = asus_start_multitouch(hdev); + if (ret) + goto err_stop_hw; + } } return 0; -- 2.53.0