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 B2DF2397922; Sat, 12 Sep 2026 10:39:36 +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=1789209578; cv=none; b=XoIrhs/YDOXwLWvIfCbrXtRCaC3uCk0Em1yvA/8CBPoimL/+C6UffjvCKz8JR+p7nlWPDtM2s42j+eIzkxJLWqUrn2kmXDgeDoqXWV7nh3TPRpRpAszXT0/s7Z0NPjp1wqx0BQmYHMU6ZSeZWLc6GJ+0Ll7T1kto0UI22Wma0dE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789209578; c=relaxed/simple; bh=tVSa5aRbCic2dnvuX0yJeqJjSNVltNiNzpVPGQemDiY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H+0ElBjJkb1HfwP5otvNaoNwNiv+ZpRQ9cHvRqUiqssrSmsm1P6QaFhYjIJnKihUMyHED+R9ra7QdsdTinaVyOBSMoZyyO8h04dRhuzOaXYFJyQOcSskAzeHWIW4LwU63sdTXK/6DNDIiTTiVk2LChigPQBegZjRY10ILb7puB0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dkjtN9Dj; 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="dkjtN9Dj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 580151F00893; Sat, 12 Sep 2026 10:39:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789209576; bh=5L2gsPIpJ7vWLNeZAOWxM/L8VSK/iXHzMDUI/keaTrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dkjtN9DjUsY9e3TqU7tUViIn9U9/4Og4wBfTvE/Lz2ig1zKRduhoysv/tT1KDnIt8 rXRRb9xtG1mhnnLlvc+w4YmSSgSB8IY4m8mBnxkBu28XqQjjV1UeuYV28Doqwsn3CR 6EW1NMh9uvBL1Z9qa+1aNKF0KNTmz8yKBbv/FwYY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jiancheng Huang , Jiri Kosina , Sasha Levin Subject: [PATCH 6.18 0849/1518] HID: lg4ff: validate report length before fixed offsets Date: Sat, 12 Sep 2026 08:50:18 +0200 Message-ID: <20260912065642.655210219@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065623.398859879@linuxfoundation.org> References: <20260912065623.398859879@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiancheng Huang [ Upstream commit be00988cce4ed44db1e61231d0ab71a64bab44cd ] lg4ff_raw_event() rewrites fixed report offsets when combined pedals are enabled. It currently assumes that each product report contains every source and destination byte used by the rewrite. Return without rewriting a short report before each product-specific access. Apply the same bound to the computed offset path. Fixes: c832f86effbc ("HID: hid-logitech: Add combined pedal support Logitech wheels") Signed-off-by: Jiancheng Huang Assisted-by: Codex:gpt-5.6-luna Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-lg4ff.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c index 32b711723f2aa..9ddd669d88f16 100644 --- a/drivers/hid/hid-lg4ff.c +++ b/drivers/hid/hid-lg4ff.c @@ -336,6 +336,8 @@ int lg4ff_raw_event(struct hid_device *hdev, struct hid_report *report, if (entry->wdata.combine) { switch (entry->wdata.product_id) { case USB_DEVICE_ID_LOGITECH_WHEEL: + if (size < 7) + return 0; rd[5] = rd[3]; rd[6] = 0x7F; return 1; @@ -343,10 +345,14 @@ int lg4ff_raw_event(struct hid_device *hdev, struct hid_report *report, case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG: case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL: case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2: + if (size < 6) + return 0; rd[4] = rd[3]; rd[5] = 0x7F; return 1; case USB_DEVICE_ID_LOGITECH_DFP_WHEEL: + if (size < 7) + return 0; rd[5] = rd[4]; rd[6] = 0x7F; return 1; @@ -366,6 +372,8 @@ int lg4ff_raw_event(struct hid_device *hdev, struct hid_report *report, } /* Compute a combined axis when wheel does not supply it */ + if (size <= offset + 1) + return 0; rd[offset] = (0xFF + rd[offset] - rd[offset+1]) >> 1; rd[offset+1] = 0x7F; return 1; -- 2.53.0