From: Artem Egorkine <arteme@gmail.com>
To: linux-usb@vger.kernel.org
Cc: Artem Egorkine <arteme@gmail.com>
Subject: [PATCH 2/2] sound: line6: fix stack overflow in line6_midi_transmit
Date: Fri, 16 Dec 2022 12:02:39 +0200 [thread overview]
Message-ID: <20221216100239.577805-2-arteme@gmail.com> (raw)
In-Reply-To: <20221216100239.577805-1-arteme@gmail.com>
Correctly calculate available space including the size of the chunk
buffer. This fixes a buffer overflow when multiple MIDI sysex
messages are sent to a PODxt device.
Signed-off-by: Artem Egorkine <arteme@gmail.com>
---
sound/usb/line6/midi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/usb/line6/midi.c b/sound/usb/line6/midi.c
index 335f8d531548..fbcb55b6e8b0 100644
--- a/sound/usb/line6/midi.c
+++ b/sound/usb/line6/midi.c
@@ -44,7 +44,8 @@ static void line6_midi_transmit(struct snd_rawmidi_substream *substream)
int req, done;
for (;;) {
- req = min(line6_midibuf_bytes_free(mb), line6->max_packet_size);
+ req = min3(line6_midibuf_bytes_free(mb), line6->max_packet_size,
+ LINE6_FALLBACK_MAXPACKETSIZE);
done = snd_rawmidi_transmit_peek(substream, chunk, req);
if (done == 0)
--
2.38.1
next prev parent reply other threads:[~2022-12-16 10:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-16 10:02 [PATCH 1/2] sound: line6: correct midi status byte when receiving data from podxt Artem Egorkine
2022-12-16 10:02 ` Artem Egorkine [this message]
2022-12-16 10:59 ` Greg KH
2022-12-16 11:00 ` Greg KH
2022-12-16 11:00 ` Greg KH
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=20221216100239.577805-2-arteme@gmail.com \
--to=arteme@gmail.com \
--cc=linux-usb@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.