All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Kosina <jikos@kernel.org>
To: Lee Jones <lee@kernel.org>
Cc: benjamin.tissoires@redhat.com, linux-kernel@vger.kernel.org,
	linux-input@vger.kernel.org
Subject: Re: [PATCH v2 1/2] HID: core: Provide new max_buffer_size attribute to over-ride the default
Date: Thu, 23 Feb 2023 11:57:24 +0100 (CET)	[thread overview]
Message-ID: <nycvar.YFH.7.76.2302231156420.1142@cbobk.fhfr.pm> (raw)
In-Reply-To: <20230123123912.360651-1-lee@kernel.org>

On Mon, 23 Jan 2023, Lee Jones wrote:

> Presently, when a report is processed, its proposed size, provided by
> the user of the API (as Report Size * Report Count) is compared against
> the subsystem default HID_MAX_BUFFER_SIZE (16k).  However, some
> low-level HID drivers allocate a reduced amount of memory to their
> buffers (e.g. UHID only allocates UHID_DATA_MAX (4k) buffers), rending
> this check inadequate in some cases.
> 
> In these circumstances, if the received report ends up being smaller
> than the proposed report size, the remainder of the buffer is zeroed.
> That is, the space between sizeof(csize) (size of the current report)
> and the rsize (size proposed i.e. Report Size * Report Count), which can
> be handled up to HID_MAX_BUFFER_SIZE (16k).  Meaning that memset()
> shoots straight past the end of the buffer boundary and starts zeroing
> out in-use values, often resulting in calamity.
> 
> This patch introduces a new variable into 'struct hid_ll_driver' where
> individual low-level drivers can over-ride the default maximum value of
> HID_MAX_BUFFER_SIZE (16k) with something more sympathetic to the
> interface.
> 
> Signed-off-by: Lee Jones <lee@kernel.org>
> ---
> v1 => v2:
>  - Edit the commit message to be less focused on UHID

Now applied to hid.git#for-6.3/upstream-fixes. Thanks,

-- 
Jiri Kosina
SUSE Labs


      parent reply	other threads:[~2023-02-23 10:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23 12:39 [PATCH v2 1/2] HID: core: Provide new max_buffer_size attribute to over-ride the default Lee Jones
2023-01-23 12:39 ` [PATCH v2 2/2] HID: uhid: Over-ride the default maximum data buffer value with our own Lee Jones
2023-02-23 10:57 ` Jiri Kosina [this message]

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=nycvar.YFH.7.76.2302231156420.1142@cbobk.fhfr.pm \
    --to=jikos@kernel.org \
    --cc=benjamin.tissoires@redhat.com \
    --cc=lee@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.