]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: line6: Fix write on zero-sized buffer
authorTakashi Iwai <tiwai@suse.de>
Tue, 2 Jul 2019 18:07:21 +0000 (20:07 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 2 Jul 2019 18:11:22 +0000 (20:11 +0200)
commit694018b5ae9b7e4d47551f346d58331f6d2b1852
treebbd7f14e4712084862a80d35a3b52f87918fbb65
parent7409699c5ddb86c9a891ce56c764d005a1686ab8
ALSA: line6: Fix write on zero-sized buffer

LINE6 drivers allocate the buffers based on the value returned from
usb_maxpacket() calls.  The manipulated device may return zero for
this, and this results in the kmalloc() with zero size (and it may
succeed) while the other part of the driver code writes the packet
data with the fixed size -- which eventually overwrites.

This patch adds a simple sanity check for the invalid buffer size for
avoiding that problem.

Reported-by: syzbot+219f00fb49874dcaea17@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/line6/pcm.c