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 74A80191F93; Sat, 12 Sep 2026 14:49:51 +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=1789224592; cv=none; b=TnKZM5Ic0cEbrzkluJls1tazTiE9UYFs6tAJRIrv021pwWK/Fo+sborytxPL6aXA1MlAjl3lKeWQkJNdFI7fgMIMbjfnhczOaONX8b40P0GX85cCHELFXPiO8hSRHxV6KnEhkXfbFfPWNHXGvXiTvRa2y2EHzK7eej/ACNbUbxY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789224592; c=relaxed/simple; bh=Aiu2FFwhBss+9UBtuNBqQ7MaEPs7u4V79JxLRwMmXXI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=StuS5QO0KBrdwHPGE47xaaenQ0BR4Jb2LJ7YeViT9IpcaCuK+pTIJzoLy/2nfP0dWqNNLbgdB0FYljyC6VTvzVyopBsj3LTLwETcDElrVcR3LqyYER4o1MLzeFJ1vaIr3tlKZozwlsL8djLtY5W/eJfaYpd6dNwBRen+NU1NQsw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QN0rQd3o; 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="QN0rQd3o" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C7A61F000FF; Sat, 12 Sep 2026 14:49:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789224591; bh=amCF4H97/nguks7SOhUV+SwbTAMiutykWqNe0WmQh7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QN0rQd3o/vcioTlCO+VNRcRNWJh7I7Siu8M8zPWFWGKqYixPnrq2kFFcjTJiSnUVY YL5HlHxRvFsbqqkTlayfMevjpOTY2IivK4OW55I1cHd9m1BklyKCY/rSeY5aKujSFs RJQNaRKhtZpnQnSUuZCTY9OR2Pln2nh3tT0CdClQ= 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.6 1024/1424] HID: lg4ff: validate report length before fixed offsets Date: Sat, 12 Sep 2026 08:57:36 +0200 Message-ID: <20260912065630.243416694@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.279695368@linuxfoundation.org> References: <20260912065607.279695368@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: 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 e3fcf1353fb3b..71f168eff29b1 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