[Devel] [PATCH RHEL8 COMMIT] Revert "vtty: possible ERR_PTR dereferencing in vtty_open_master"

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jun 9 14:19:28 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.37
------>
commit caa17d4ff4eda9c41bbed4c434e35c67cb0e7339
Author: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
Date:   Wed Jun 9 14:19:28 2021 +0300

    Revert "vtty: possible ERR_PTR dereferencing in vtty_open_master"
    
    This reverts commit ca6395691df2d4b880725e2fbfffda2ea7ef9118.
    https://jira.sw.ru/browse/PSBM-83150
    
    Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
---
 drivers/tty/pty.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 237fe13d5270..b4ab0eacca5b 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -1432,11 +1432,6 @@ int vtty_open_master(envid_t veid, int idx)
 	vtty_set_context(veid);
 
 	tty = vtty_lookup(vttym_driver, NULL, idx);
-	if (IS_ERR(tty)) {
-		ret = PTR_ERR(tty);
-		goto err_install;
-	}
-
 	if (!tty ||
 	    (test_bit(TTY_OTHER_CLOSED, &tty->flags) ||
 	     test_bit(TTY_OTHER_CLOSED, &tty->link->flags))) {
@@ -1448,10 +1443,8 @@ int vtty_open_master(envid_t veid, int idx)
 		if (tty)
 			vtty_map_clear(tty);
 		tty = tty_init_dev(vttys_driver, idx);
-		if (IS_ERR(tty)) {
-			ret = PTR_ERR(tty);
+		if (IS_ERR(tty))
 			goto err_install;
-		}
 		tty->count--;
 		tty_unlock(tty);
 		tty = tty->link;


More information about the Devel mailing list