From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Johan Hovold <johan@kernel.org>
Cc: Zhang Cen <rollkingzzc@gmail.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] USB: serial: cypress_m8: fix memory corruption with small endpoint
Date: Fri, 22 May 2026 13:35:48 +0200 [thread overview]
Message-ID: <2026052243-playmaker-lyricist-7968@gregkh> (raw)
In-Reply-To: <20260522101621.927034-1-johan@kernel.org>
On Fri, May 22, 2026 at 12:16:21PM +0200, Johan Hovold wrote:
> Make sure that the interrupt-out endpoint max packet size is at least
> eight bytes to avoid user-controlled slab corruption or NULL-pointer
> dereference should a malicious device report a smaller size.
>
> Fixes: 3416eaa1f8f8 ("USB: cypress_m8: Packet format is separate from characteristic size")
> Cc: stable@vger.kernel.org # 2.6.26
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/usb/serial/cypress_m8.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
> index afff1a0f4298..82ba0900b399 100644
> --- a/drivers/usb/serial/cypress_m8.c
> +++ b/drivers/usb/serial/cypress_m8.c
> @@ -445,6 +445,14 @@ static int cypress_generic_port_probe(struct usb_serial_port *port)
> return -ENODEV;
> }
>
> + /*
> + * The buffer must be large enough for the one or two-byte header (and
> + * following data) but assume anything smaller than eight bytes is
> + * broken.
> + */
> + if (port->interrupt_out_size < 8)
> + return -EINVAL;
> +
> priv = kzalloc_obj(struct cypress_private);
> if (!priv)
> return -ENOMEM;
> --
> 2.53.0
>
>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
next prev parent reply other threads:[~2026-05-22 11:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 10:16 [PATCH] USB: serial: cypress_m8: fix memory corruption with small endpoint Johan Hovold
2026-05-22 11:35 ` Greg Kroah-Hartman [this message]
2026-05-22 14:16 ` Cen Zhang
2026-05-22 14:28 ` Johan Hovold
2026-05-22 14:42 ` Cen Zhang
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=2026052243-playmaker-lyricist-7968@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rollkingzzc@gmail.com \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox