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=1796385864; b=hOeIxdO0qtqFmHfzV5UgNYsk7NWzmFuRtlRMw6dvUO6zLvFG62wR57VDa6v80/88SrRb avd4b6lDbLtj/RBCAk2Wm+iIFYunowxsOagPuyxTJPgnSWHCIgReA3hJLkblMwaTh0zst W0DP9HIK7ZUj9vdo5NOIdkBuDIUYn5YBhZW66OX6LfTprs54ADBioEvlPSpp/KzcYAkpt dS4oCRujjPxqjknTma31QPSuGon6jXkcz4rCG3JuMVqbC3g7EGumyd9wCoaVnMpn1va4B WNlY5e3zyDO80U8zhr23PrXf/Q4+ouJAsma33IKiEzg6qh4HUBk1TwoT6kGzXBYp8xw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385864; 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=HbrhzTQ/0u1sJonvQuJhXC3tk3/TtX1/0X2RWM5QCN4=; b=0PjXHA1phYNtXUPgdgrQKJYUjcnKilXmXwziDZVtwVRToRH/ps4OfoOtOq+O624irvU3 CnftlqHi9hkI89P0Kfr8I5rlq5omALE6v77xIAqmySB3Wvvd5mAdFtvmI6w7uhJ8unYhN FWiMtL+mGmGrVQuaZ93aNCr4La0ji8n9oG9mWUmkJLjifKlFwJKa7ebCeO7SpQtuPU6Je F7RqchFc05Dsb64w35Dnszyi/mZrnuJZlIpdNMwOewD5z9O3A8OYJjX7fW7ckSJiDvmRM s1AJ8agBcEGWcVMkVNdArzyCyXODhsOFd8WIPT4VoaipAwylENsawmvKsAMuN6Lzu3Q== 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=X8pcXec0; 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 5C80E606A332; Fri, 4 Dec 2026 12:04:24 +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=X8pcXec0 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC6C31F000C2; Fri, 4 Dec 2026 12:04:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385864; bh=HbrhzTQ/0u1sJonvQuJhXC3tk3/TtX1/0X2RWM5QCN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=X8pcXec0kx3n7v5yd68pskbm5GHaYthcVlqfCxdStdqGJU57A/cdeqYg7qlGbvVAE 5kBD7owwjaVQ+OWqzs/FX/kbWiv0uM61pxiqUP8np0DJbp7sKD+icu37RVDKjkmzzC duy8x+WQYMS8Dhp+ZMcHJdf5jKGeiywsCyqxskhA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Johan Hovold Subject: [PATCH 6.6 0673/1167] USB: serial: io_edgeport: fix potential close() use-after-free Date: Fri, 4 Dec 2026 19:01:40 +0900 Message-ID: <20261204100719.589407576@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: 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.6-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));