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=1796388459; b=DlSmxaMQcQKGZ99OsXuOXXMNXMAeBih8msI7hx+/Yt/zPUxbJVKka+WGzDG6T1EqFcvG /ycVHexNFoU9zUAvLR1h9NkFPnZ890Cal36O8SIlsDW4n8vQnAM3w6uJqkhtpwOidUK09 +8gisWbU/3aZaQFOveWo+2KQhDwbkqeGyn2ZAWvj9c/dgZ+hnHkSOSkpb9qKL0C+PBeAU oE0rwKJGbL6EPB+pVGhl3QECDQu7vqi4k6WpXXSL8oOfILGyj47oqcWDZPs/S3c4bDkV5 IFd9dIbB1bqCKHTvrup3ul2Aa2UvDR7rbbSglEG0TkVufVT+G9Q1MDVyYrRcF6DINAQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388459; 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=AG0lAruKE1KWxNMC+khPD+hPXOCFYg8sw92Qx3/3sbs=; b=SElckN4pXen+t+epPQihsOW/ocjE/mrWFiBe1JKh0SF1VEn+Ss4aQVgq+Jx7+LFLqz1v f2WcbgdTGR05fWhMNHl3b+8W9KmkxDKQDksdkJ/nz0yGWhmtWLV4Qs1q2qBr76xjLKDGe w6h+oShtJ60gsnKeaR3cm5zP63nvPMXGJBgQZEYVeyJ0mSwNPC9y6S3NM3ihYrv0era1y qUlAMprk7drUwzxsjx6bfK7g9ozR7d/1p6t23vYq+jTYxQnFsdC8fmn7pjGwZUawFwJuI YRdRp0/Nhg8D2B7SGSAw5Pq00FCBFPEYJt3hbN8ex/PMEPyrOpWiFMuPzCuufKk+4oQ== 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=qfDKfH2d; 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 80B3F606A32F; Fri, 4 Dec 2026 12:47:39 +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=qfDKfH2d Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3DA21F000C2; Fri, 4 Dec 2026 12:47:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388459; bh=AG0lAruKE1KWxNMC+khPD+hPXOCFYg8sw92Qx3/3sbs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qfDKfH2dc7BnVLIMXT91WkhxkQk0g65uZR3C7O/VD38BOF2f6c1i+AD35t2hY56d9 TQ9rBD91903y2i81P4Op548rLk+1sEqnbDolY6FrUaytmZaVIFGP8edkKixsmqGDdP COFMIpt2DFrV9Wz2mFpZYtJEGzssd2Ca++zezi9I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Johan Hovold Subject: [PATCH 6.1 0620/1059] USB: serial: io_edgeport: fix potential close() use-after-free Date: Fri, 4 Dec 2026 19:02:31 +0900 Message-ID: <20261204100700.167832331@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: 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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 839ff5fa30995c40cd5fba15fd976ad63416738a upstream. Add the missing open check on write() and locking when updating the port status during close() to prevent a racing interrupt completion handler from trying to submit more data for the port while its write URB and FIFO are being deallocated. 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 | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -1085,7 +1085,9 @@ static void edge_close(struct usb_serial /* port->close = true; */ edge_port->closePending = false; + spin_lock_irq(&edge_port->ep_lock); edge_port->open = false; + spin_unlock_irq(&edge_port->ep_lock); edge_port->openPending = false; usb_kill_urb(edge_port->write_urb); @@ -1127,6 +1129,12 @@ static int edge_write(struct tty_struct spin_lock_irqsave(&edge_port->ep_lock, flags); + /* avoid accessing freed fifo if tty_wakeup() races with close() */ + if (!edge_port->open) { + spin_unlock_irqrestore(&edge_port->ep_lock, flags); + return 0; + } + /* calculate number of bytes to put in fifo */ copySize = min((unsigned int)count, (edge_port->txCredits - fifo->count));