[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250129160520.2485991-1-jkeeping@inmusicbrands.com>
Date: Wed, 29 Jan 2025 16:05:19 +0000
From: John Keeping <jkeeping@...usicbrands.com>
To: linux-usb@...r.kernel.org
Cc: John Keeping <jkeeping@...usicbrands.com>,
stable@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kees Cook <kees@...nel.org>,
Abdul Rahim <abdul.rahim@...ahoo.com>,
Michael Grzeschik <m.grzeschik@...gutronix.de>,
Jeff Johnson <quic_jjohnson@...cinc.com>,
Felipe Balbi <balbi@...com>,
Daniel Mack <zonque@...il.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH] usb: gadget: f_midi: fix MIDI Streaming descriptor lengths
In the two loops before setting the MIDIStreaming descriptors,
ms_in_desc.baAssocJackID[] has entries written for "in_ports" values and
ms_out_desc.baAssocJackID[] has entries written for "out_ports" values.
But the counts and lengths are set the other way round in the
descriptors.
Fix the descriptors so that the bNumEmbMIDIJack values and the
descriptor lengths match the number of entries populated in the trailing
arrays.
Cc: stable@...r.kernel.org
Fixes: c8933c3f79568 ("USB: gadget: f_midi: allow a dynamic number of input and output ports")
Signed-off-by: John Keeping <jkeeping@...usicbrands.com>
---
drivers/usb/gadget/function/f_midi.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index 837fcdfa3840f..6cc3d86cb4774 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -1000,11 +1000,11 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
}
/* configure the endpoint descriptors ... */
- ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports);
- ms_out_desc.bNumEmbMIDIJack = midi->in_ports;
+ ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports);
+ ms_out_desc.bNumEmbMIDIJack = midi->out_ports;
- ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports);
- ms_in_desc.bNumEmbMIDIJack = midi->out_ports;
+ ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports);
+ ms_in_desc.bNumEmbMIDIJack = midi->in_ports;
/* ... and add them to the list */
endpoint_descriptor_index = i;
--
2.48.1
Powered by blists - more mailing lists