All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+c35f34092a4bc9855be6@syzkaller.appspotmail.com>
To: eadavis@sina.com
Cc: eadavis@sina.com, linux-kernel@vger.kernel.org,
	 syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [usb?] KASAN: stack-out-of-bounds Write in append_midi1_out_jack
Date: Wed, 26 Aug 2026 05:30:49 -0700	[thread overview]
Message-ID: <6a8edc79.27659fcc.2ceef7.0001.GAE@google.com> (raw)
In-Reply-To: <20260826123034.119675-1-eadavis@sina.com>

> From: Edward Aadm Davis <eadavis@sina.com>
>
> #syz test

"" does not look like a valid git branch or commit.

>
> diff --git a/drivers/usb/gadget/function/f_midi2.c b/drivers/usb/gadget/function/f_midi2.c
> index 19fdac024343..06a3add05447 100644
> --- a/drivers/usb/gadget/function/f_midi2.c
> +++ b/drivers/usb/gadget/function/f_midi2.c
> @@ -1675,11 +1675,15 @@ static int append_midi1_in_jack(struct f_midi2 *midi2,
>  				struct midi1_cable_mapping *map,
>  				unsigned int type)
>  {
> -	struct usb_midi_in_jack_descriptor *jack =
> -		&config->jack_ins[config->jack_in++];
> -	int id = ++config->jack_id;
> +	struct usb_midi_in_jack_descriptor *jack;
> +	int id;
>  	int err;
>  
> +	if (config->jack_in >= MAX_CABLES)
> +		return -EINVAL;
> +
> +	id = ++config->jack_id;
> +	jack = &config->jack_ins[config->jack_in++];
>  	jack->bLength = 0x06;
>  	jack->bDescriptorType = USB_DT_CS_INTERFACE;
>  	jack->bDescriptorSubtype = USB_MS_MIDI_IN_JACK;
> @@ -1700,11 +1704,15 @@ static int append_midi1_out_jack(struct f_midi2 *midi2,
>  				 struct midi1_cable_mapping *map,
>  				 unsigned int type, unsigned int source)
>  {
> -	struct usb_midi_out_jack_descriptor_1 *jack =
> -		&config->jack_outs[config->jack_out++];
> -	int id = ++config->jack_id;
> +	struct usb_midi_out_jack_descriptor_1 *jack;
> +	int id;
>  	int err;
>  
> +	if (config->jack_out >= MAX_CABLES)
> +		return -EINVAL;
> +
> +	id = ++config->jack_id;
> +	jack = &config->jack_outs[config->jack_out++];
>  	jack->bLength = 0x09;
>  	jack->bDescriptorType = USB_DT_CS_INTERFACE;
>  	jack->bDescriptorSubtype = USB_MS_MIDI_OUT_JACK;

  reply	other threads:[~2026-08-26 12:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 11:49 [syzbot] [usb?] KASAN: stack-out-of-bounds Write in append_midi1_out_jack syzbot
2026-08-26 12:30 ` Edward Adam Davis
2026-08-26 12:30   ` syzbot [this message]
2026-08-26 12:35 ` Edward Adam Davis
2026-08-26 13:20   ` syzbot
2026-08-26 13:46 ` [PATCH] usb: gadget: midi2: prevent in/out jack from oob Edward Adam Davis
2026-08-28 12:07   ` Takashi Iwai
2026-08-29  2:05     ` Edward Adam Davis

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=6a8edc79.27659fcc.2ceef7.0001.GAE@google.com \
    --to=syzbot+c35f34092a4bc9855be6@syzkaller.appspotmail.com \
    --cc=eadavis@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    /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.