[CRIU] [PATCH 3/3] tty: Goto err when fail to unlock master pty

Radostin Stoyanov rstoyanov1 at gmail.com
Sat Nov 17 00:28:53 MSK 2018


Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
 criu/tty.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/criu/tty.c b/criu/tty.c
index 38e1cab3..11acfc18 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -997,7 +997,8 @@ static int pty_open_unpaired_slave(struct file_desc *d, struct tty_info *slave)
 				goto err;
 			}
 
-			unlock_pty(master);
+			if (unlock_pty(master))
+				goto err;
 
 			if (opts.orphan_pts_master &&
 			    rpc_send_fd(ACT_ORPHAN_PTS_MASTER, master) == 0) {
@@ -1036,7 +1037,8 @@ static int pty_open_unpaired_slave(struct file_desc *d, struct tty_info *slave)
 			goto err;
 		}
 
-		unlock_pty(master);
+		if (unlock_pty(master))
+			goto err;
 
 		fd = open_tty_reg(slave->reg_d, slave->tfe->flags);
 		if (fd < 0) {
@@ -1098,7 +1100,8 @@ static int pty_open_ptmx(struct tty_info *info)
 		return -1;
 	}
 
-	unlock_pty(master);
+	if (unlock_pty(master))
+		goto err;
 
 	if (restore_tty_params(master, info))
 		goto err;
-- 
2.17.2



More information about the CRIU mailing list