[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231101133544.246961-1-renmingshuai@huawei.com>
Date: Wed, 1 Nov 2023 21:35:44 +0800
From: Ren Mingshuai <renmingshuai@...wei.com>
To: <davem@...emloft.net>
CC: <edumazet@...gle.com>, <kuba@...nel.org>, <jirislaby@...nel.org>,
<caowangbao@...wei.com>, <yanan@...wei.com>, <liaichun@...wei.com>,
<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] tty: hso: Fix potential null pointer dereference
Generally, the old always points to the address of a ktermios structure,
so old is unlikely to be NULL. Still check it before dereference as
elsewhere.
Signed-off-by: Ren Mingshuai <renmingshuai@...wei.com>
---
drivers/net/usb/hso.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index ce1f6081d582..4ad829ab54d3 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1396,7 +1396,8 @@ static void hso_serial_set_termios(struct tty_struct *tty,
if (serial->port.count)
_hso_serial_set_termios(tty);
else
- tty->termios = *old;
+ if (old)
+ tty->termios = *old;
spin_unlock_irqrestore(&serial->serial_lock, flags);
/* done */
--
2.33.0
Powered by blists - more mailing lists