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=1796385736; b=WN12FeWwxevgYk2pxXy+H5QiNJe5nqKZtqnbZwSO5s7bd/jk3K01vEX8TRZzjsicUNy2 wJoaoHA6hrMahcr+3ro/0Z67YebqgWv2Iu+UZBfD7CsNP6SnM+vMSuDH40J7TxIGKT58E 4SwvCzAtsPn3xlFHYy8Nrl8NzD7Z6JMTKEoICXLs7mJexOHGwNUiKGf5hUli/rcyn2keT BKo7T4tb0IRyIve6yfu0ZAuI8VyNaKJ/qfPGPbVc3uPXzYsDU2PANEEGaHY2C2w+tB/33 cf3NC7V1OnRsWmpD/n3RHQXsf4MJs5sFNqAOmOwAbwCWvTXSbKVGuoSsb+AkAFJYf4A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385736; 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=dbs50ufw6IPjr0vO6X68DTLeHd8ZzdfzVyUqP1cu334=; b=DZwU0t3RTySlc53WYYfRoVaFzTIYpNAAe1AUgoiyJgARuVPG+Lcj5gglkv5FHUsyb1hV b4d+D028UW2t7deK2SYmh1fa/YCzoCRjuoCUUXqacoASCNy8giFzqIJEfoS2yEkn/qdFR bDYkxfOo+yTnJ2ZzzOSAdZfvyGPAyB191b0p3m1p4v6uGGK3O8ZD21YVX6o8zUi30I0WP 8btAFDjWzKRUm4eabtZY3lgypX/3sg5xxseOT1s035R52VzcrEYzCHYG+nRydiEp2XIB2 KempebpvlxkEoqaFVZEnaPAv4qJiFIx4Sq7iP8WolmI093XduW+5T64AkSCv08RMeXA== 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=dhuCNTOH; 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 B3B91606A322; Fri, 4 Dec 2026 12:02:16 +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=dhuCNTOH Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DCD91F000CE; Fri, 4 Dec 2026 12:02:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385736; bh=dbs50ufw6IPjr0vO6X68DTLeHd8ZzdfzVyUqP1cu334=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dhuCNTOHDH9LOP0fg3VbJX2AK0QO4cFKyEOe28Gd34D7/jY6463USEC/caIDVbn7C Bz2fXoZDHWiYcvFXf1xEbPOGbL3niaNwLoSMCAAUjByefUjKtDaA6/LcJ2pmvyg0R0 IPeWjSayge6s6EDqRBqM5PW9eSDXhoJ18AwTAMOU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Maksim Salau , Johan Hovold Subject: [PATCH 6.6 0671/1167] USB: serial: upd78f0730: fix NULL-deref on hangup Date: Fri, 4 Dec 2026 19:01:38 +0900 Message-ID: <20261204100719.535677787@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: 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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 0e0b1fcfb80c0490bda7f7eb633ebb5e431c2e16 upstream. The port tty pointer is cleared on hangup before deasserting the modem control signals and should not be used in the dtr_rts() callback. Factor out a new upd78f0730_port_tiocmset() helper that can be used in upd78f0730_dtr_rts() to avoid dereferencing a NULL-pointer on hangup (e.g. on disconnect). This issue was flagged by an LLM. Fixes: ea534e0b4047 ("USB: serial: add uPD78F0730 USB to Serial Adaptor Driver") Cc: stable@vger.kernel.org # 4.11 Cc: Maksim Salau Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/upd78f0730.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/drivers/usb/serial/upd78f0730.c +++ b/drivers/usb/serial/upd78f0730.c @@ -201,10 +201,9 @@ static int upd78f0730_tiocmget(struct tt return res; } -static int upd78f0730_tiocmset(struct tty_struct *tty, +static int upd78f0730_port_tiocmset(struct usb_serial_port *port, unsigned int set, unsigned int clear) { - struct usb_serial_port *port = tty->driver_data; struct upd78f0730_port_private *private; struct upd78f0730_set_dtr_rts request; struct device *dev = &port->dev; @@ -238,6 +237,13 @@ static int upd78f0730_tiocmset(struct tt return res; } +static int upd78f0730_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) +{ + struct usb_serial_port *port = tty->driver_data; + + return upd78f0730_port_tiocmset(port, set, clear); +} + static int upd78f0730_break_ctl(struct tty_struct *tty, int break_state) { struct upd78f0730_port_private *private; @@ -267,7 +273,6 @@ static int upd78f0730_break_ctl(struct t static void upd78f0730_dtr_rts(struct usb_serial_port *port, int on) { - struct tty_struct *tty = port->port.tty; unsigned int set = 0; unsigned int clear = 0; @@ -276,7 +281,7 @@ static void upd78f0730_dtr_rts(struct us else clear = TIOCM_DTR | TIOCM_RTS; - upd78f0730_tiocmset(tty, set, clear); + upd78f0730_port_tiocmset(port, set, clear); } static speed_t upd78f0730_get_baud_rate(struct tty_struct *tty)