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=1796056036; b=EnbqEqGu0I/yKug+ZSRT+HLIZZ+r8cOKp3Wk8zhPkB8gPmh4jL6EMPh+Rgt3RSixD5AZ HoRC3l+suFqlOnZHoOAd588nfsxIsVKe8TVGAknH0gxn7SMO0YPwE0dx6rIhDqGMA/hkv ne/F1U0EODJWnd0B5+IgEyrSByy8Gwg07d/QLNRXxlgC/jbmXf8+7lWwUOUhlKjMmu436 KEbyKgjIDVfNNv2Jl25wRcv8Nr2rJ0/e7Vo7EQoLWM1sglYoiLSBkkSE5I9CSAoYuoF06 tjKcThHQeWbYn3J27eMq7eMa0oEkyvm8aE4c/ac9rZaic65/8gjMSyWYZOHZrowNjpA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796056036; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=X5oywp5lKwuTpUz3+QBcWZppD/EXQ7YMeM0mERRf0PU=; b=Jiq935ElDS4Oe9zD+2+vA/W78EcYPJWluw4qY7sWF/zdKUmBjTjXStMWoUiFqdFHL7zl GJlR8pcyubjmevf6MckMYcsZ6CxubmnixZhjLQXN333FYRQRlYYi6m3bvQ+lBD+owcm4o gJRhoCNcjXFUvWGh/QE94Cr5oW66324bn9R+UshUp/ETer9LbeIOPkkCdfY3B2aNXkgp0 JoWbXxjJps7tay9Ypjp93mUEjrDAzD30wILNpnpu4YlR9lSjXFTrYJYl6ACvU8Kech4il q3Y5VTiTek5f5B7N3U8oFdCYSPUuQyw/nXWuSYgl7FGAfNgWQAk/1xuC6C0zv6HrAOQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="TA1F/gH3"; 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 AFE4F606A320 for ; Mon, 30 Nov 2026 16:27:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TA1F/gH3 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6B6D1F00924; Mon, 30 Nov 2026 16:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796056036; bh=X5oywp5lKwuTpUz3+QBcWZppD/EXQ7YMeM0mERRf0PU=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=TA1F/gH3q+4PnUSbLChseFQj/TNNIsFYIWCluXISVH31D+6icXAkkPr1DOLjk+j9b YysZQmlulzUlcocQzOLibFvg3YEsnfbp6wgUPKmTeNdLJWv1L3gYXqECdkstsjCVD+ dhrFL43Y1qfhjYKEtx5fR4PNigVR1uVLKnMykvzcstHazJ7RkYmtAwV89VRy/4QWB2 JPKMcXyBvGPYpriLpH6YEb37RNAWGq8hzVdX2vlM9/VZsa5gaNpslrxElhdIuUngdT ICvA6nYY1FX+9dAiDn//Kh1v6RBGOHxuoYVX3kRectnfZhUW0EvYK4mgRZTz9p8lly N/Rtg7itb1azw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2] tty: do not drop hangups during reopen Reply-To: sashiko-reviews@lists.linux.dev To: "YuanZhe Liu" <25031212351@stu.xidian.edu.cn> Cc: linux-serial@vger.kernel.org In-Reply-To: <20261130161204.5003-1-25031212351@stu.xidian.edu.cn> References: <20261130161204.5003-1-25031212351@stu.xidian.edu.cn> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 16:27:15 +0000 X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > TTY_HUPPED is only cleared after ->open() has returned. A tty that is > reopened while still being referenced by another process therefore > remains marked as hung up for the duration of the new open, including > while a blocking open sleeps in tty_port_block_til_ready(). >=20 > __tty_hangup() ignores hangup requests while TTY_HUPPED is set, so a > hangup (e.g. from USB disconnect) that races with such an open is > dropped: the line discipline and the new file reference are not hung up, > and the port remains initialised while the driver tears down its port > data. The blocked open then calls into the driver with the port data > already gone. >=20 > Clear TTY_HUPPED when reopening the tty, while holding the tty lock, so > that a hangup racing with the open is not ignored and the line > discipline and file references are hung up in one go. >=20 > This was found while analysing a NULL-pointer dereference in > pl2303_dtr_rts() on USB disconnect. Only compile-tested on x86_64. >=20 > Fixes: d4855e1fc03c ("tty: Reset hupped state on open") > 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> Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130161204.5003= -1-25031212351@stu.xidian.edu.cn?part=3D1