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-next>] [day] [month] [year] [list]
Message-Id: <1580285224-7712-1-git-send-email-loic.poulain@linaro.org>
Date:   Wed, 29 Jan 2020 09:07:04 +0100
From:   Loic Poulain <loic.poulain@...aro.org>
To:     gregkh@...uxfoundation.org, jslaby@...e.com
Cc:     linux-kernel@...r.kernel.org,
        Loic Poulain <loic.poulain@...aro.org>
Subject: [PATCH] tty_port: Restore tty port default ops on unregistering

When a port is unregistered from serdev, its serdev specific client_ops
pointer is nullified, which can lead to future null pointer dereference.
Fix that by restoring default client_ops when port is unregistered from
serdev.

port registering/unregistering can happen several times, at least it
happens when statically registered 8250 ISA port are replaced at boot
time by e.g. device-tree defined 8250 ports.

Signed-off-by: Loic Poulain <loic.poulain@...aro.org>
---
 drivers/tty/tty_port.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
index 044c3cb..bf893da 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
@@ -203,8 +203,10 @@ void tty_port_unregister_device(struct tty_port *port,
 	int ret;
 
 	ret = serdev_tty_port_unregister(port);
-	if (ret == 0)
+	if (ret == 0) {
+		port->client_ops = &default_client_ops;
 		return;
+	}
 
 	tty_unregister_device(driver, index);
 }
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ