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=1796385755; b=vNKr+/FXpIXyyWFB1p96P+XZWB6FsDbo14t67qR3pmI8N2aWszQZ6OlIfn5pz+iaiyy2 ySU7xBpvioCDpwpdDY3uOnZ16HQD1zdX35KzHia9MZiNoeJan9mZfMmWh2ypzqQzAUdqb hBd6poJix/Obj8kMIDNOaUfKz56XdTGaI/0RB4EsWnEzFLfaFVgXAl3TM74BWnNCO3q2n J9bftUDl/N3qINsL48bYStDf4pAYOQ23qVptZBAglgjzdIKerDoaQYvJZ5KeCcIeiTGHL 1TXf39cWjpwmXX5yR3xVedvS/Qz9ILmp446ytT/kOZSWTB6aEz4qr2SjrUOJxcjckJg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385755; 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=ctDQ2BoiBtGUyIao17BG61AqOwzcuUM6DUsNlFMiSIg=; b=z1XxvR+cAyyYqpQhUaeLCQiegEHHL/2TKoL8l9a+pMFlMjKIeG96UWdvPI18a35wTrGx F/zHybx0J/3Gk8WZ9iPnH9ujmNQbWqiWKwij0Lr6L1MQtdS5yXdxsal31EEG7HI1OfpLx A6GfBC3A8lVJRz+x3qReZjV+/wiRniMN6AyNetwxwDev1J7nPB82Sok8LXaM+MjLitLl/ aBicMbounTATdN3DA0873/zBdpkFCboLbeHAFDuADDBpAzXQu/xIATPzIf9LSmofo/Xf7 6cuXOMl3Ze19eRcL5mkyEL+HhUMFgrxooZP98GxZFCOWc5VSD9jexjghO1uEzsKlL8Q== 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=aGFDbvGo; 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 CE288606A32C; Fri, 4 Dec 2026 12:02:35 +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=aGFDbvGo Received: by smtp.kernel.org (Postfix) with ESMTPSA id F21C31F000CE; Fri, 4 Dec 2026 12:02:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385755; bh=ctDQ2BoiBtGUyIao17BG61AqOwzcuUM6DUsNlFMiSIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aGFDbvGoLq8MXHDyEgR3F+bQjQWZxA9mDBsRZRGtJh87mXN5+g4K35pSwuS1DnSE3 2sBh6cR8iFCqtyKcREPF46gzuG1API37wp2esAN5VTp8GgyesAOPq9e97N+YhcFz9y L97How/DMqd0ys6HUle0s9paKuUGFZnyU3blGauc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Johan Hovold Subject: [PATCH 6.6 0674/1167] USB: serial: io_edgeport: fix potential NULL-deref at open Date: Fri, 4 Dec 2026 19:01:41 +0900 Message-ID: <20261204100719.614936542@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 a0403880a0a638f189e5187068244d9fd5bc8d4d upstream. Do not mark the port as open until after the write FIFO has been allocated and initialised to prevent a racing interrupt completion from attempting to send stale data and dereference the FIFO buffer pointer. Note that the open flag defaults to false and is cleared on close() so there is no need to reinitialise it on every open(). Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/io_edgeport.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -885,9 +885,7 @@ static int edge_open(struct tty_struct * /* send a open port command */ edge_port->openPending = true; - edge_port->open = false; 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__); edge_port->openPending = false; @@ -897,8 +895,7 @@ static int edge_open(struct tty_struct * /* now wait for the port to be completely opened */ wait_event_timeout(edge_port->wait_open, !edge_port->openPending, OPEN_TIMEOUT); - - if (!edge_port->open) { + if (edge_port->openPending) { /* open timed out */ dev_dbg(dev, "%s - open timeout\n", __func__); edge_port->openPending = false; @@ -926,6 +923,10 @@ static int edge_open(struct tty_struct * return -ENOMEM; } + spin_lock_irq(&edge_port->ep_lock); + edge_port->open = true; + spin_unlock_irq(&edge_port->ep_lock); + dev_dbg(dev, "%s - Initialize TX fifo to %d bytes\n", __func__, edge_port->maxTxCredits); @@ -1818,7 +1819,6 @@ static void process_rcvd_status(struct e /* we have completed the open */ edge_port->openPending = false; - edge_port->open = true; wake_up(&edge_port->wait_open); return; }