From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B91A4325706; Sun, 7 Jun 2026 10:58:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780829899; cv=none; b=qlbI2RU/G/IQhHcZ7qE9nzTzOgAU1QEOpLZvNsamVzx+UmUQc+gOZe9nRx174NL+imppAAmk4TtgtgmGJfzNq+m8t2DQgjDLKVTkRc7V0HSGlp8n9RjYC52jh3IiJGsTSpTMkPhO0+2zDHBYAQSkIYOQfVAdqp1hQhu1o9aDLtI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780829899; c=relaxed/simple; bh=Cb9i7sFkwmczR3xCE0cuBu1qoJrPqaU9JdeMJFA1l6c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GBOjfN99JQh0PzRF4yN1+YVetypoVuVfbkuEzmlCxOV68J89/Hh1Hdon3GLGg9dR94MwXxWj1pQhvZZW18/UHUiWTJFfNwmiJeiCaF0PI6dQ08XPHiADElfC9p1aMMOB3VNO2Q6iO4UT3GCuepc+sBebf1PcGVXVw+b60fIb66Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=I3sXpgT0; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="I3sXpgT0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5C781F00893; Sun, 7 Jun 2026 10:58:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780829898; bh=WXCAEK5E6TYnF69i5lDvzqTFiGdy1ahf58hNaUmNa6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=I3sXpgT0iVDqY1MINXccZ1Sp0/Uf7s9mwmhYk4Wrd90UGAoeS62zY6EnY+u7+w2XB dLW8sxbJFWRvas3Hzt+Wr9AYoSYFXvTfQ8jXZaszTvdajFa180jZ3J9C+lt9OYAFgE 4Zd5l5Q2f5ZOx74NoXuPca7wPPyZTUBXfqPbR5MY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Johan Hovold , Sasha Levin Subject: [PATCH 6.12 263/307] USB: serial: digi_acceleport: fix memory corruption with small endpoints Date: Sun, 7 Jun 2026 12:01:00 +0200 Message-ID: <20260607095737.363882040@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260607095727.647295505@linuxfoundation.org> References: <20260607095727.647295505@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit cb3560e8eab1dfa1cac1ed52631adf8ec6ff2cd5 upstream. Add the missing bulk-out buffer size sanity checks to avoid out-of-bounds memory accesses or slab corruption should a malicious device report smaller buffers than expected. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reviewed-by: Greg Kroah-Hartman Signed-off-by: Johan Hovold Signed-off-by: Sasha Levin --- drivers/usb/serial/digi_acceleport.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index a064859654121d..a876d6629b65d1 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c @@ -1229,15 +1229,34 @@ static int digi_port_init(struct usb_serial_port *port, unsigned port_num) static int digi_startup(struct usb_serial *serial) { struct digi_serial *serial_priv; + int oob_port_num; int ret; + int i; + + /* + * The port bulk-out buffers must be large enough for header and + * buffered data. + */ + for (i = 0; i < serial->type->num_ports; i++) { + if (serial->port[i]->bulk_out_size < DIGI_OUT_BUF_SIZE + 2) + return -EINVAL; + } + + /* + * The OOB port bulk-out buffer must be large enough for the two + * commands in digi_set_modem_signals(). + */ + oob_port_num = serial->type->num_ports; + if (serial->port[oob_port_num]->bulk_out_size < 8) + return -EINVAL; serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL); if (!serial_priv) return -ENOMEM; spin_lock_init(&serial_priv->ds_serial_lock); - serial_priv->ds_oob_port_num = serial->type->num_ports; - serial_priv->ds_oob_port = serial->port[serial_priv->ds_oob_port_num]; + serial_priv->ds_oob_port_num = oob_port_num; + serial_priv->ds_oob_port = serial->port[oob_port_num]; ret = digi_port_init(serial_priv->ds_oob_port, serial_priv->ds_oob_port_num); -- 2.53.0