]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ALSA: ump: Fix buffer overflow at UMP SysEx message conversion
authorTakashi Iwai <tiwai@suse.de>
Tue, 29 Apr 2025 12:48:41 +0000 (14:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 May 2025 07:44:00 +0000 (09:44 +0200)
commitce4f77bef276e7d2eb7ab03a5d08bcbaa40710ec
tree9c51dc3629e270afa241a94a125c2fb042994520
parenteae60cfe25d022d7f0321dba4cc23ad8e87ade48
ALSA: ump: Fix buffer overflow at UMP SysEx message conversion

[ Upstream commit 56f1f30e6795b890463d9b20b11e576adf5a2f77 ]

The conversion function from MIDI 1.0 to UMP packet contains an
internal buffer to keep the incoming MIDI bytes, and its size is 4, as
it was supposed to be the max size for a MIDI1 UMP packet data.
However, the implementation overlooked that SysEx is handled in a
different format, and it can be up to 6 bytes, as found in
do_convert_to_ump().  It leads eventually to a buffer overflow, and
may corrupt the memory when a longer SysEx message is received.

The fix is simply to extend the buffer size to 6 to fit with the SysEx
UMP message.

Fixes: 0b5288f5fe63 ("ALSA: ump: Add legacy raw MIDI support")
Reported-by: Argusee <vr@darknavy.com>
Link: https://patch.msgid.link/20250429124845.25128-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/sound/ump_convert.h