{"id":2215485,"url":"http://patchwork.ozlabs.org/api/patches/2215485/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-i2c/patch/20260324173527.11321-1-sebasjosue84@gmail.com/","project":{"id":35,"url":"http://patchwork.ozlabs.org/api/projects/35/?format=json","name":"Linux I2C development","link_name":"linux-i2c","list_id":"linux-i2c.vger.kernel.org","list_email":"linux-i2c@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260324173527.11321-1-sebasjosue84@gmail.com>","list_archive_url":null,"date":"2026-03-24T17:35:27","name":"HID: ft260: validate report size in raw_event handler","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"2a1d39694b558a62cf99355a6a1b06c7928b2939","submitter":{"id":92955,"url":"http://patchwork.ozlabs.org/api/people/92955/?format=json","name":"Sebastian Alba Vives","email":"sebasjosue84@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-i2c/patch/20260324173527.11321-1-sebasjosue84@gmail.com/mbox/","series":[{"id":497322,"url":"http://patchwork.ozlabs.org/api/series/497322/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-i2c/list/?series=497322","date":"2026-03-24T17:35:27","name":"HID: ft260: validate report size in raw_event handler","version":1,"mbox":"http://patchwork.ozlabs.org/series/497322/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2215485/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2215485/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-i2c+bounces-16706-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-i2c@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=oxkX9Zi9;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-i2c+bounces-16706-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"oxkX9Zi9\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.221.176","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgHQj5Lxwz1y1g\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 04:41:33 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 091D6304AAD7\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 24 Mar 2026 17:35:42 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id E990D40822F;\n\tTue, 24 Mar 2026 17:35:36 +0000 (UTC)","from mail-vk1-f176.google.com (mail-vk1-f176.google.com\n [209.85.221.176])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 082013EF670\n\tfor <linux-i2c@vger.kernel.org>; Tue, 24 Mar 2026 17:35:33 +0000 (UTC)","by mail-vk1-f176.google.com with SMTP id\n 71dfb90a1353d-56ce07a54e8so985272e0c.2\n        for <linux-i2c@vger.kernel.org>; Tue, 24 Mar 2026 10:35:33 -0700 (PDT)","from localhost.localdomain ([2a09:bac6:d6dd:aa::11:17b])\n        by smtp.gmail.com with ESMTPSA id\n 71dfb90a1353d-56cdd9f7c6fsm16844594e0c.0.2026.03.24.10.35.31\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Tue, 24 Mar 2026 10:35:32 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774373736; cv=none;\n b=Kke5mkDwwUiLKn6PM9qSAmQ7mJR662Vn8AwUTlg+KpFLNnhIQPTdKxd+r4BtnDyEBuWVYi+0Rx/YM/igzO6QMh512svJJngLUwna5at6UESt8qjgq+XIUGlXBaPTMsIhXUMs1nLDVlksH6Lk5F4aOzQa9XKxVODh5lYQSW1wTJU=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774373736; c=relaxed/simple;\n\tbh=ovVs3AWOZjlyKru7AE1DWVSZIN+/WI9oHTLy46VoejQ=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=omBzrnP+1yIYyW2EuAZGJze/+cO1n/8Q6OW7bKg6DgGhNFIJqplE8Dj7+bQ0vS+L8P5Q6qgtaul7hA4mix9MX2uxWjm16pMVcgP71/7q61cCRTPxFJczWyvPs/Gutu1Am9eyUgoLpKxqYNiyyUaePWCuWSM9jtoQ3GV44Cs0UaU=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=oxkX9Zi9; arc=none smtp.client-ip=209.85.221.176","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1774373733; x=1774978533;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:from:to:cc:subject:date:message-id:reply-to;\n        bh=KyYn06XDchtaJ0qC9SwQHF6RATVlz66/knGROoEPpBE=;\n        b=oxkX9Zi9HxEiKfCtqdjJhPdCph1anegLeatQSlYHx4pTYvB1m+aTJqxB0kCZsOtEVY\n         cFIGDEluvoklptcI1FMS2TaeMDPevGpxYDAToj7UjA0czz4jcLkyJ23ZfJNgJQNvo0wc\n         D/Glaeg4XDyXu75Vl/y3tzVqQC6QiVuShvS6bTaKD3P/Yq6r1p8XUAFQmyLe+Ndf3yYX\n         jeT5R2F7Zu0ZrrTQC6u1/jb6vuUUmnZqyWU52sFiJNtHC32DHdE7UhQHeg27RN+E7M3h\n         5dBMwaJtrhiUALSstvMF6ifbC/wb/nINIK6PHHjts2Martw7e1bRhjq5jQOsKqq6E7N1\n         ifgA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1774373733; x=1774978533;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=KyYn06XDchtaJ0qC9SwQHF6RATVlz66/knGROoEPpBE=;\n        b=M2OkXXQU7LSipPAzBUTHNryaWQvNlQtck/wPr0lxz/ppJBCna2QFNRP/u/yp8nWtuv\n         pJjg6LADjICp++WL1xoYgZkAcEW0BFXI6aymJCiu4w9gUiswZ7cdaEcEIP+esIiRnMID\n         v3TUcEk//E6bAD3m2qi3h2OH8inMBwon1CIiC1bZPLfdXRzzwKsRmkZPngMJam67g4Rf\n         dQMzzc/FYrRFBkXMsHWjcLmlKR16LA/ad+dzlzUE0U/dgdzn2rQ7iN8iSoe9QaMnc4zj\n         bkqOJFBMHjryH26NAUMKCL19p6x9D1XyQi8hLSxWRg93seCkKeTS/qFOPPHSMBi35QE6\n         t5NA==","X-Gm-Message-State":"AOJu0Yz0E3juWHyQgB0/PGdcsb+4OqtbOg/kvg68Ns4q4/9Yrpxd/+Ax\n\tfzcQLeZ+xBUYcwdCYjqZlTKek2iYvwF1IiZ7GTRz1r7M9JQM814ludRX","X-Gm-Gg":"ATEYQzxTTHMuoSHBEUmL4kmi4pPCcdPqxN+CC5kA5j7gPFEi+oBJfNkRI9dSZEAQJ+U\n\td0WRcfR8BrRNLvNSqXCl9Z7G8+UGh+lMdlY99LTFds/x7SNKUxgF23FLqofC48nG6Q9443lXsSn\n\tPwyCV0KcmpRhepUcRh7MPfw4764xQ4E5aMxDclp5cezt0USjoW35YDES7GZEgd6xvOWskShS1Rs\n\tfnRPw+GQJy/fa/rRoQHZ84lveUn4SAJb6/VjxLerOFHSCC50CqZvnpaY6oviubPRTxBZNvWyh2C\n\taU+YTXSyuMhjk14SfHfy5dgrCotU+vaVXsLPH/rlQI7TI0ehfbQa0rWMIlFMbIw1pZiO2EhIZ1W\n\toXV+B+ueKGDCJMt65KTB74NnVmyWXq1r0kdepxDGK1LemxLkqnr+SotJlK3q4l6eYlzYhwdPPC/\n\tyWBWDypCDmU5Y390/FXcq0wbRn","X-Received":"by 2002:a05:6122:e1ae:b0:56b:5893:d042 with SMTP id\n 71dfb90a1353d-56d2207aecamr479688e0c.12.1774373733002;\n        Tue, 24 Mar 2026 10:35:33 -0700 (PDT)","From":"Sebastian Josue Alba Vives <sebasjosue84@gmail.com>","To":"michael.zaidman@gmail.com,\n\tjikos@kernel.org,\n\tbentiss@kernel.org","Cc":"linux-i2c@vger.kernel.org,\n\tlinux-input@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tstable@vger.kernel.org,\n\tSebastian Josue Alba Vives <sebasjosue84@gmail.com>","Subject":"[PATCH] HID: ft260: validate report size in raw_event handler","Date":"Tue, 24 Mar 2026 11:35:27 -0600","Message-ID":"<20260324173527.11321-1-sebasjosue84@gmail.com>","X-Mailer":"git-send-email 2.43.0","Precedence":"bulk","X-Mailing-List":"linux-i2c@vger.kernel.org","List-Id":"<linux-i2c.vger.kernel.org>","List-Subscribe":"<mailto:linux-i2c+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-i2c+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"ft260_raw_event() casts the raw data buffer to a\nft260_i2c_input_report struct and accesses its fields without\nvalidating the size parameter. Since __hid_input_report() invokes\nthe driver's raw_event callback before hid_report_raw_event()\nperforms its own report-size validation, a device sending a\ntruncated HID report can cause out-of-bounds heap reads in the\nkernel.\n\nIn the I2C response path, xfer->length (data[1]) is used as the\nlength for a memcpy into dev->read_buf. While xfer->length is\nchecked against dev->read_len, there is no check that size is large\nenough to actually contain xfer->length bytes of data starting at\noffset 2. A malicious USB device could therefore cause an OOB read\nfrom the kernel heap, with the result accessible from userspace via\nthe I2C read interface.\n\nFT260 devices use 64-byte HID reports. Add a check at the top of\nthe handler to reject any report shorter than expected, and log a\nwarning to aid debugging.\n\nCc: stable@vger.kernel.org\nSigned-off-by: Sebastian Josue Alba Vives <sebasjosue84@gmail.com>\n---\n drivers/hid/hid-ft260.c | 6 ++++++\n 1 file changed, 6 insertions(+)","diff":"diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c\nindex 333341e80..7ca323992 100644\n--- a/drivers/hid/hid-ft260.c\n+++ b/drivers/hid/hid-ft260.c\n@@ -1068,6 +1068,12 @@ static int ft260_raw_event(struct hid_device *hdev, struct hid_report *report,\n \tstruct ft260_device *dev = hid_get_drvdata(hdev);\n \tstruct ft260_i2c_input_report *xfer = (void *)data;\n \n+\t/* FT260 always sends 64-byte reports */\n+\tif (size < 64) {\n+\t\thid_warn(hdev, \"report too short: %d < 64\\n\", size);\n+\t\treturn 0;\n+\t}\n+\n \tif (xfer->report >= FT260_I2C_REPORT_MIN &&\n \t    xfer->report <= FT260_I2C_REPORT_MAX) {\n \t\tft260_dbg(\"i2c resp: rep %#02x len %d\\n\", xfer->report,\n","prefixes":[]}