linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Korsnes <jkorsnes@cisco.com>
To: linux-usb@vger.kernel.org
Cc: Johan Korsnes <jkorsnes@cisco.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	Armando Visconti <armando.visconti@st.com>,
	Jiri Kosina <jkosina@suse.cz>
Subject: [PATCH 2/2] HID: core: increase HID report buffer size to 8KiB
Date: Wed, 15 Jan 2020 13:33:44 +0100	[thread overview]
Message-ID: <20200115123344.4650-2-jkorsnes@cisco.com> (raw)
In-Reply-To: <20200115123344.4650-1-jkorsnes@cisco.com>

We have a touch device that reports its opens and shorts test results
in HID buffers of size 8184 bytes. With this patch we're able to
successfully obtain these reports.

Alan Stern: Your commit 8ec321e96e05 ("HID: Fix slab-out-of-bounds
read in hid_field_extract") states:

"This patch fixes the problem by rejecting any report whose total
length exceeds the HID_MAX_BUFFER_SIZE limit (minus one byte to allow
for a possible report index). In theory a device could have a report
longer than that, but if there was such a thing we wouldn't handle it
correctly anyway."

Is this something we have to worry about when increasing the buffer
size? Or are you referring to the fact that we previously truncated
the reports if they exceeded max buffer size?

Signed-off-by: Johan Korsnes <jkorsnes@cisco.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Armando Visconti <armando.visconti@st.com>
Cc: Jiri Kosina <jkosina@suse.cz>
---
 include/linux/hid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/hid.h b/include/linux/hid.h
index cd41f209043f..875f71132b14 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -492,7 +492,7 @@ struct hid_report_enum {
 };
 
 #define HID_MIN_BUFFER_SIZE	64		/* make sure there is at least a packet size of space */
-#define HID_MAX_BUFFER_SIZE	4096		/* 4kb */
+#define HID_MAX_BUFFER_SIZE	8192		/* 8kb */
 #define HID_CONTROL_FIFO_SIZE	256		/* to init devices with >100 reports */
 #define HID_OUTPUT_FIFO_SIZE	64
 
-- 
2.24.1


  reply	other threads:[~2020-01-15 12:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15 12:33 [PATCH 1/2] HID: core: fix off-by-one memset in hid_report_raw_event() Johan Korsnes
2020-01-15 12:33 ` Johan Korsnes [this message]
2020-01-15 15:21   ` [PATCH 2/2] HID: core: increase HID report buffer size to 8KiB Alan Stern
2020-01-15 15:50     ` Johan Korsnes (jkorsnes)
2020-01-17 10:15       ` Jiri Kosina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200115123344.4650-2-jkorsnes@cisco.com \
    --to=jkorsnes@cisco.com \
    --cc=armando.visconti@st.com \
    --cc=jkosina@suse.cz \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).