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=1796053066; b=of1eqhpsWkRshFuK6zsP7DPMpRYob7xXq4DgolwR0Yw3dXh5FBNqIfUpeCJP/f9fgv0l DjadqVAxof7Ix1WOjSOgb8B7cgFQxerfvX3MMdHk47qsGKEd+KQ3JYduxFBqIttQpafEv 1XAv7XuiGvPp0BURWgBkgz9v+fTYjcpj3s5njDHYAXRhqMCO2O2Q5R/aaHvUwf8aaafXd DS047/mG3hs76QjyHGuSpJX7p7ckKNj3LugsN8h6owTchuzOf2aCTY6R3pXs0i1UEKwrd Tdr4tIptjjwqsCafdPJw/e5bydLuiPRed3oTBQBGP6WTGx40nJX4nSNtljo7TmJvjRg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796053066; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=PLOv28RbrZGzf0kEBaS6TflTHC/Zmvuv6BvqLS3NT8A=; b=b7nOQbigCsGbnY+Ndd1QOdho1zclcUOXUn2C9tXoA1Vq4wCtMMopbDgz1T0p1ijoKC9h YAWEjr4HvbFeLBOsDXoFRtsy6GvyJ1YlySGyTXJ2FH/h+eoeJMVWz174DuJ585gcGnx09 EjtlMm3vTp1UrD03ZcCgKdBZnGy8+a+F1E866YnHED+tfwymCUmyIsA1Em22Ro8yg7x2s rZYopKRW+6vgWxq6PVVYY80mLelaX0Qs16qGlSxbXD1bXuGGIRAIpYuoHNHaP9uy2PTWz Tfajnwfy5Kjmxo/i0eEjnZeqd4X5Or/q933B3XSpqu9RtYBh7YMFlePhhxuhCk0JgVw== 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=QuawFH5r; 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 67C25606A329; Mon, 30 Nov 2026 15:37:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=QuawFH5r Received: by smtp.kernel.org (Postfix) with ESMTPSA id 503661F00932; Mon, 30 Nov 2026 15:37:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796053065; bh=PLOv28RbrZGzf0kEBaS6TflTHC/Zmvuv6BvqLS3NT8A=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=QuawFH5rp09FFodxuidRQhs+BcH50jfzC8pKaOzf3QfRPwVbsvv6YXBbWWz80qZ8B LBeY6p3LZvuMJ+bvLGNE5F4LH/Ln+iTkPaQiYWwXypmdVE3hHN4bZ8PXFXP2Kn0ysW oxz4K9lXC1MARKIo222XGeZ2UQJyobTOxU0pqs0I= Date: Mon, 30 Nov 2026 16:37:43 +0100 From: Greg Kroah-Hartman To: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Cc: Jiri Slaby , Johan Hovold , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, stable@vger.kernel.org, Bin Yu , Cheng Wen Subject: Re: [PATCH] tty: port: fix hangup of a reopened tty Message-ID: <2026113039-untangled-headsman-e0cf@gregkh> References: <20261130141413.10581-1-25031212351@stu.xidian.edu.cn> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261130141413.10581-1-25031212351@stu.xidian.edu.cn> On Mon, Nov 30, 2026 at 10:14:13PM +0800, YuanZhe Liu wrote: > Drivers rely on tty_port_tty_vhangup() to synchronously hang up their > port before releasing port resources at deregistration (e.g. on physical > disconnect). > > tty_vhangup() does nothing if the tty has already been hung up. If the > tty is reopened while still being referenced by another process, the new > open may reactivate the port, but TTY_HUPPED is only cleared once the > open has completed. A hangup request during that window is therefore > dropped and the port remains initialised while the driver tears down its > port data. > > A blocking open then ends up calling into the driver (e.g. dtr_rts() or > carrier_raised()) with the port data already gone. > > Make sure the port is shut down after tty_vhangup() also when the tty has > already been hung up. > > This was found while analysing a NULL-pointer dereference in > pl2303_dtr_rts() on disconnect. > > Fixes: b48820de8c1a ("tty: port: fix tty_port_tty_vhangup() race") > Cc: stable@vger.kernel.org > Co-developed-by: Bin Yu > Signed-off-by: Bin Yu > Co-developed-by: Cheng Wen > Signed-off-by: Cheng Wen > Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn> > --- > drivers/tty/tty_port.c | 21 +++++++++++++++++---- > 1 file changed, 17 insertions(+), 4 deletions(-) How was this found and tested? And are you sure this isn't fixed in newer kernel releases? Johan did some work on the hangup path here, so verifying if that fixed this or not would be good. Also note that the pl2303 driver might have different issues than all tty drivers due to them being on the usb bus... thanks, greg k-h