From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385814; b=gM5N5CZyatNzRUnnbDb2WzXxF8UsLAkXKbzYgSX2AJFYvN9qC06skMnOBNOJUr9I2kVY ZqAGinOa/0jOGUlI66c58av8s/Z0b6PNuPuuAJ+ag+pfLp0lx4QcKHcy00EiT1hrweDxJ 5Ke/kByixZXDOuL6sCph5vJzBl74yUqTUSNil7Hdmsmzh9DzKtxhp78x+MBls7BKv+X7U wdWBuym31s8EV6rdFkSiD1cHp4k5uZqQKQizQhx7aJ0vcCQGyL+2CUJkM+3oQDpxafKiL GZF+HDRhrdE+eKrsRqU5UkaJAUzterBe8YlDZOZBymbRtavMBz01jQp+9R0CRT+Qfiw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385814; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=AroxpAZB7COlYNxTrWZq9N7J5KydzcbXxUPgm0DxTHE=; b=hQeb4L1+uGlsHMFeEDQ+duVsSZLtErd0WkcZYTbJyA5IiNpYDkAnss7RxD8r/ezobP5u zjf+C0tQxNonmQYRdtFSBvxffVkJdh+rb37LEh0mq5JS1F1TzcRzE+2Wyi1iz4cLe4Tho W2VOLOTN9qJ4JlxK8uJIsYBegLKuQ+71ur8HuixQfwl6rD4HBX54Jzd9BRzv326ILPv/i /alI+sFrpGGAWm7lfu7iAfYRZdqLsxvqOnwQRi2K7AAQZHGdzGyHBQ5vRSl7mGY6Iblt4 ihmUeKnQb5cYF4rgipbplGunwY7LOJzUnaFKeysMTMSwiOqFu008m7sAHZOoBkB+7CQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=o798ap+A; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98454606A32F; Fri, 4 Dec 2026 12:03:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=o798ap+A Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBF751F000CE; Fri, 4 Dec 2026 12:03:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385813; bh=AroxpAZB7COlYNxTrWZq9N7J5KydzcbXxUPgm0DxTHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=o798ap+A4Buz6dbdWSo6LOHef0kd4mI/7mZv9bTGsF9HuaDfxHCTJS5S7UoFklQUX J38GkyQyMxNYkase4AckQxJpLgYC+iOYyt8Vk/XytpmLcyxqQfruHu2aSSVPm9uLQs vTS0WjFIi95ASGaeCCGNdVQsN9zu1SplzoS9tYUE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Johan Hovold Subject: [PATCH 6.6 0676/1167] USB: serial: io_edgeport: fix potential fifo corruption Date: Fri, 4 Dec 2026 19:01:43 +0900 Message-ID: <20261204100719.667000600@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 270f76c3b88c9cc3d6ca58c5c0c0f34c2373b27c upstream. The device buffer size is determined during open() and the driver allocates a TX FIFO of corresponding size. Add the missing sanity check to prevent memory corruption in case a malicious device sends a second open response with a different buffer size. This issue was flagged by Sashiko when reviewing a related fix. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Link: https://sashiko.dev/#/patchset/20260714101316.823942-1-shpark061104%40gmail.com?part=1 Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/io_edgeport.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -877,13 +877,17 @@ static int edge_open(struct tty_struct * } /* initialize our port settings */ + spin_lock_irq(&edge_port->ep_lock); edge_port->txCredits = 0; /* Can't send any data yet */ + edge_port->maxTxCredits = 0; + edge_port->openPending = true; + spin_unlock_irq(&edge_port->ep_lock); + /* Must always set this bit to enable ints! */ edge_port->shadowMCR = MCR_MASTER_IE; edge_port->chaseResponsePending = false; /* send a open port command */ - edge_port->openPending = true; response = send_iosp_ext_cmd(edge_port, IOSP_CMD_OPEN_PORT, 0); if (response < 0) { dev_err(dev, "%s - error sending open port command\n", __func__); @@ -1736,6 +1740,7 @@ static void process_rcvd_status(struct e struct edgeport_port *edge_port; struct device *dev; __u8 code = edge_serial->rxStatusCode; + unsigned long flags; /* switch the port pointer to the one being currently talked about */ if (edge_serial->rxPort >= edge_serial->serial->num_ports) @@ -1779,6 +1784,12 @@ static void process_rcvd_status(struct e } if (code == IOSP_STATUS_OPEN_RSP) { + spin_lock_irqsave(&edge_port->ep_lock, flags); + /* reject stray open responses to avoid FIFO corruption */ + if (!edge_port->openPending) { + spin_unlock_irqrestore(&edge_port->ep_lock, flags); + return; + } edge_port->txCredits = GET_TX_BUFFER_SIZE(byte3); edge_port->maxTxCredits = edge_port->txCredits; dev_dbg(dev, "%s - Port %u Open Response Initial MSR = %02x TxBufferSize = %d\n", @@ -1787,6 +1798,8 @@ static void process_rcvd_status(struct e /* we have completed the open */ edge_port->openPending = false; + spin_unlock_irqrestore(&edge_port->ep_lock, flags); + wake_up(&edge_port->wait_open); return; }