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 7707A3FE662; Wed, 20 May 2026 18:38:39 +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=1779302320; cv=none; b=LrfilvJL1cm+SG0K0Nl4Peu90hHmbhRXhyJscB+3cTjQJo7rtckK1NX3UIPT4mXN4D57KCSWlO3XgCO86R6nor0oqFUi2Qs0sZ/0ZmFbTRXKzuYJONVD+BCo9V7xnkESaGeXLcG/Bhc0dgNbZ0IdmAyCNmHePzUe1ispkXmW7P4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779302320; c=relaxed/simple; bh=DWAymP6MTlG+8+HoQvAmkakAWEkFvjisD2XqSPgzx5M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QPWfcNlJ5E3FqylQ8y+ESiV1DRpGrEe+blz98j4vWKhzORQuLormSbOU499Oryv+XZ61Ie9uC6s4QfExLdlvgb+cdKZzjmGnF1TtbWZg047JsrJXa4kchTjgDpvy8bb0jgLeEQS9vzlnodVDJCzgt18O9uIKcxwKtFos0zla2/Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UJ6Tv78Y; 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="UJ6Tv78Y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC4851F000E9; Wed, 20 May 2026 18:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779302319; bh=PqKphAK0HqduW+ZN973iEYUp7RsnNI8XM2lZksTkLKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UJ6Tv78YN9ZT5sZ3ZDP5nOGca09NwezUW4TY0FIOHUiOHXIIQTaOtFV9053iEzR4G PSIbVY/CaR13EpBl0B1+xMSMIUDU/vE8jqf2dYsutCZ9P1oJT+h3345MudgjUtgbMg HMqcupgCYO1NGZnXCkczHnoLnay5CBUePtgr9vg4= 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.6 223/508] HID: asus: do not abort probe when not necessary Date: Wed, 20 May 2026 18:20:46 +0200 Message-ID: <20260520162103.471681527@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162058.573354582@linuxfoundation.org> References: <20260520162058.573354582@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 6.6-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 e4ea87cdb05fd..d3913f70d263d 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -1118,22 +1118,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