lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231102020908.692325-1-renmingshuai@huawei.com>
Date:   Thu, 2 Nov 2023 10:09:08 +0800
From:   Ren Mingshuai <renmingshuai@...wei.com>
To:     <gregkh@...uxfoundation.org>
CC:     <caowangbao@...wei.com>, <davem@...emloft.net>,
        <edumazet@...gle.com>, <jirislaby@...nel.org>, <kuba@...nel.org>,
        <liaichun@...wei.com>, <linux-kernel@...r.kernel.org>,
        <linux-usb@...r.kernel.org>, <renmingshuai@...wei.com>,
        <yanan@...wei.com>
Subject: Re: [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.
>
>If it can not happen, there is no need to check it.  So unless you can
>prove that this ever could happen, this change isn't needed, right?
>
>thanks,
>
>greg k-h
Thanks for reply. I agree with you. The reason for checking old there
is that it is checked at the beginning in hso_serial_set_termios(). It is
better to check it both or not, right?
Delete it to avoid smatch complaints.
drivers/net/usb/hso.c:1399 hso_serial_set_termios() error: we previously assumed 'old' could be null (see line 1389).

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 4ad829ab54d3..383ff8b04473 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1386,10 +1386,9 @@ static void hso_serial_set_termios(struct tty_struct *tty,
        struct hso_serial *serial = tty->driver_data;
        unsigned long flags;

-       if (old)
-               hso_dbg(0x16, "Termios called with: cflags new[%u] - old[%u]\n",
-                       (unsigned int)tty->termios.c_cflag,
-                       (unsigned int)old->c_cflag);
+       hso_dbg(0x16, "Termios called with: cflags new[%u] - old[%u]\n",
+               (unsigned int)tty->termios.c_cflag,
+               (unsigned int)old->c_cflag);

        /* the actual setup */
        spin_lock_irqsave(&serial->serial_lock, flags);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ