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 82C1F324B0A; Fri, 7 Aug 2026 14:59:52 +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=1786114793; cv=none; b=lEbZjDSoB4qdSk+W6tPFqbzJpoAhQoaUAdxP5Rnx2n7slTpoPgeaOcY9yWJGLFW6r/5VAay/WOJAjdL9aASG8TM4HRizTG/oSNE95U3uLvTEaCOZtbwU3phr6jQMbuL6frrbbG385fOOVUw0QG2GL9FcHHQte+FKZjzv3qtpNlI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786114793; c=relaxed/simple; bh=hI7LN8DLNz3G07bL4Hipwo1q+oTkBNs0awodxT7mD2Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rG7ketnq/ovOkaZLkXq0j9MlGyD5P+EmtOzMyCwmxujLMnsbwbo3UHhelw3ALknnAdea/UQ3SGGJHN1jxQF8xJWdc3K8NOxx6nKatWlFjCPnPeXigq+GmZ3vQhwXn+2n1qyJW9A9F9Ksm4k28WUQUNxtNqho+/aBuB8wPg1uYZI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=La0nPbSR; 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="La0nPbSR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7CA21F000E9; Fri, 7 Aug 2026 14:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786114792; bh=dQ7kouNiHOjGi98FqCPw9JCPICUulExK6CzfVvPRvGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=La0nPbSRQ8C4rF9k/M78Qm/xk5f4EtjYXLoZ7b5IlDbvREvlDNVgyTG6nQYYvMXGx rdzRkTm3wrByRdZircas6cN3AcE3tNWZLY6hFl36+v+zz1Blzq0YS37QadVDPr3AeE QSraSJ3JLeThgk2NVS6K01hYKhbu4Z/XEk5OH7gs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Lee Jones , Jiri Kosina , Sasha Levin Subject: [PATCH 6.18 009/396] HID: logitech-dj: Prevent REPORT_ID_DJ_SHORT related user initiated OOB write Date: Fri, 7 Aug 2026 16:32:49 +0200 Message-ID: <20260807143424.473532992@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260807143424.272339768@linuxfoundation.org> References: <20260807143424.272339768@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: Lee Jones [ Upstream commit b6a57912854e7ea36f3b270032661140cc4209cd ] logi_dj_recv_send_report() assumes that all incoming REPORT_ID_DJ_SHORT reports are 14 Bytes (DJREPORT_SHORT_LENGTH - 1) long. It uses that assumption to load the associated field's 'value' array with 14 Bytes of data. However, if a malicious user only sends say 1 Byte of data, 'report_count' will be 1 and only 1 Byte of memory will be allocated to the 'value' Byte array. When we come to populate 'value[1-13]' we will experience an OOB write. Signed-off-by: Lee Jones Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-logitech-dj.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index d6fb7015f0d77..3a37d61616293 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c @@ -1750,6 +1750,7 @@ static int logi_dj_probe(struct hid_device *hdev, const struct hid_device_id *id) { struct hid_report_enum *input_report_enum; + struct hid_report_enum *output_report_enum; struct hid_report *rep; struct dj_receiver_dev *djrcv_dev; struct usb_interface *intf; @@ -1793,6 +1794,15 @@ static int logi_dj_probe(struct hid_device *hdev, } } + output_report_enum = &hdev->report_enum[HID_OUTPUT_REPORT]; + rep = output_report_enum->report_id_hash[REPORT_ID_DJ_SHORT]; + + if (rep->maxfield < 1 || rep->field[0]->report_count != DJREPORT_SHORT_LENGTH - 1) { + hid_err(hdev, "Expected size of DJ short report is %d, but got %d", + DJREPORT_SHORT_LENGTH - 1, rep->field[0]->report_count); + return -EINVAL; + } + input_report_enum = &hdev->report_enum[HID_INPUT_REPORT]; /* no input reports, bail out */ -- 2.53.0