From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BEB403D891A; Wed, 8 Apr 2026 18:12:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775671979; cv=none; b=bULTOC95BttCx+Bakdl3Yj0O9NVcIVPqrRb5k7Vv2hzzoVpRdbGyeUlWeq7VPbcoqCBVOwSROrH8R2UCO7kM2FDyGlZiS8BqqzWdohYDSjM8FgrGUnqe1vW7d2IeNcIEIkioPARXPSoB4osB/cEJkbDjSBpAMT+j4sL3lA2yOec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775671979; c=relaxed/simple; bh=SRXj2zp04/qY3fFsNn5uoscUoMUxYsgU0/0MOcZULZ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VQfyggD+cvHV0NK7tOsZ2MNAwFFqNED24lyMC29Qz8RjUGr82F4vNKi347bznu9BUWZC2fpAvMj43rrVTiAV1H408J9IM5vybfYOH7ivohSENTiHEMeV3QAh/E64FVePx/91PmfbzG0I+5zskn9EsMFKJZ6tBHNjHQ9sGt3R5H8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UMEo+Q8I; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UMEo+Q8I" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54B68C19421; Wed, 8 Apr 2026 18:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1775671979; bh=SRXj2zp04/qY3fFsNn5uoscUoMUxYsgU0/0MOcZULZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UMEo+Q8Iq8d3kwG3dOKI8VHT1/peNyy0Bq4E1ZsEXemUmuW7rYNmwWfHBBooWC5Q5 VNruZx+ZOlSPbn8WarHGwQqpMHdIVQDNzJwWqOyFIRXjLeMCweT7LH6EqCiy1E6XE1 Hu+VJpmkyQS4Xn4u9Xe/jriXACoepW4JyfJMeRKo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Lee Jones , Benjamin Tissoires , Sasha Levin Subject: [PATCH 6.1 142/312] HID: multitouch: Check to ensure report responses match the request Date: Wed, 8 Apr 2026 20:00:59 +0200 Message-ID: <20260408175939.073776241@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260408175933.715315542@linuxfoundation.org> References: <20260408175933.715315542@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lee Jones [ Upstream commit e716edafedad4952fe3a4a273d2e039a84e8681a ] It is possible for a malicious (or clumsy) device to respond to a specific report's feature request using a completely different report ID. This can cause confusion in the HID core resulting in nasty side-effects such as OOB writes. Add a check to ensure that the report ID in the response, matches the one that was requested. If it doesn't, omit reporting the raw event and return early. Signed-off-by: Lee Jones Signed-off-by: Benjamin Tissoires Signed-off-by: Sasha Levin --- drivers/hid/hid-multitouch.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index b6c2cb7153fde..0039508943626 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -472,12 +472,19 @@ static void mt_get_feature(struct hid_device *hdev, struct hid_report *report) dev_warn(&hdev->dev, "failed to fetch feature %d\n", report->id); } else { + /* The report ID in the request and the response should match */ + if (report->id != buf[0]) { + hid_err(hdev, "Returned feature report did not match the request\n"); + goto free; + } + ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, buf, size, 0); if (ret) dev_warn(&hdev->dev, "failed to report feature\n"); } +free: kfree(buf); } -- 2.53.0