[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1568989415.843775932@decadent.org.uk>
Date: Fri, 20 Sep 2019 15:23:35 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org, Denis Kirjanov <kda@...ux-powerpc.org>,
syzbot+219f00fb49874dcaea17@...kaller.appspotmail.com,
"Takashi Iwai" <tiwai@...e.de>
Subject: [PATCH 3.16 123/132] ALSA: line6: Fix write on zero-sized buffer
3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <tiwai@...e.de>
commit 3450121997ce872eb7f1248417225827ea249710 upstream.
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@...kaller.appspotmail.com
Signed-off-by: Takashi Iwai <tiwai@...e.de>
[bwh: Backported to 3.16:
- Driver doesn't support asymmetrical packet sizes, so only check
snd_line6_pcm::max_packet_size
- Adjust filename]
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
drivers/staging/line6/pcm.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/drivers/staging/line6/pcm.c
+++ b/drivers/staging/line6/pcm.c
@@ -492,6 +492,11 @@ int line6_init_pcm(struct usb_line6 *lin
usb_rcvisocpipe(line6->usbdev, ep_read), 0),
usb_maxpacket(line6->usbdev,
usb_sndisocpipe(line6->usbdev, ep_write), 1));
+ if (!line6pcm->max_packet_size) {
+ dev_err(line6pcm->line6->ifcdev,
+ "cannot get proper max packet size\n");
+ return -EINVAL;
+ }
line6pcm->properties = properties;
line6->line6pcm = line6pcm;
Powered by blists - more mailing lists