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=1796388462; b=rzNZJlthHY+ue1PHXOG3Bm5mj+RNxhjhYCNe3oTTao+77r1s6eO3uVTqlzAdoq1krCSP CmP72dxmTRbpMg6Pc9nXpWavD3S6NjP8Uc4VdzokaPnbgApvX7cuYcXuF5lCmGSQsTixX MoDu6pz6Wbpce4pYrvn/IRXz5vBMfK1lLxgHXqJ5OgyZB2wgP3WC8NeogKap3aL6LL6vT s7YLG93bBaq1Xq3vbEHsoRDBx10OS91KBObbpZ1Fm+5gzwWEca1Yg9Om1Bn6FFHYutc+3 4Iw4+pgzwDos4tT6lPPpHk3NRDNerlxyndHcM1bPazj5UX1kvv3z6gN95JlAtU/zXGw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388462; 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=y8uuGFiKhmKLkxUbhOjoFl/5jAGepc9XqKjEiJKQd34=; b=QTn6e2e82sknkvXHZ+3t+StQEFaCYk208J625rA9HQqhuM1Tps39p88jLe59YVPQ4Z+t JjenKqA/otViTQ04gGYxjBn7I2zjYIk0MByR+EUyg6k0TREJFsq9n6CS/saO6Vx7ckOmk 4EAeP2BGRYDb0Vz+b6kiQmxZyLg8Z9ySc4NDaLGiPi8KmKGozDL3HF276UNUYE5z4t8I+ XT7sfpKiuK/pnGBkc1DlbEdztnAFoFyW9LAYfI86w/upxh1BLGvdrVvMoDTICoq7oHo50 fe197B/q2ncQsXcJCjczU294yI4wgo+AmhZtTx3qxAhxqXTXj3iADXPohfxWRz8ddag== 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=SlS7uoaM; 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 34B95606A337; Fri, 4 Dec 2026 12:47:41 +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=SlS7uoaM Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3095C1F000C2; Fri, 4 Dec 2026 12:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388461; bh=y8uuGFiKhmKLkxUbhOjoFl/5jAGepc9XqKjEiJKQd34=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SlS7uoaMIRt0EHqYyYR7w5+gzURPRWFpxo9qVNGids/THnZc9/kvZ3ObD2WlTPFOy kRgju/XVEjjg7eXtk35R8tM+kg1fMtieHjrBE2gIvLD6ETwjHIOV0e/Cpz6QPMdXhA re9y1zn3JAIcIJMGL/5nT56bnm5AcactHDSqcKgA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Johan Hovold Subject: [PATCH 6.1 0621/1059] USB: serial: io_edgeport: fix potential NULL-deref at open Date: Fri, 4 Dec 2026 19:02:32 +0900 Message-ID: <20261204100700.192372330@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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; }