[CRIU] [PATCH] tty: Make sure deprecated logic does not take wrong branch

Cyrill Gorcunov gorcunov at openvz.org
Thu Sep 8 01:32:22 PDT 2016


Don't do additional processing for ext-tty which are
expected to not have regfile in image.

Reported-by: Andrey Vagin <avagin at openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
I definitely shouldn't make patch when feel tierd, better
to defer it until morning ;) Here is a fix for ef46acb9de0
from criu-dev

 criu/tty.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/criu/tty.c b/criu/tty.c
index 401b72c83fe5..8090e22ff285 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -1546,16 +1546,18 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg, struct cr_img *i)
 	info->reg_d = try_collect_special_file(info->tfe->id, 1);
 	if (!info->reg_d) {
 		if (info->driver->type != TTY_TYPE__EXT_TTY) {
-			pr_err("No reg_d descriptor for id %#x\n", info->tfe->id);
-			return -1;
-		} else if (!deprecated_ok("TTY w/o regfile"))
-			return -1;
+			if (!deprecated_ok("TTY w/o regfile"))
+				return -1;
 
-		if (is_pty(info->driver)) {
-			info->reg_d = pty_alloc_reg(info, true);
-			if (!info->reg_d) {
-				pr_err("Can't generate new reg descriptor for id %#x\n",
-				       info->tfe->id);
+			if (is_pty(info->driver)) {
+				info->reg_d = pty_alloc_reg(info, true);
+				if (!info->reg_d) {
+					pr_err("Can't generate new reg descriptor for id %#x\n",
+					       info->tfe->id);
+					return -1;
+				}
+			} else {
+				pr_err("No reg_d descriptor for id %#x\n", info->tfe->id);
 				return -1;
 			}
 		}
-- 
2.7.4



More information about the CRIU mailing list