criu/1001-backport-tty-fix-the-null-pointer-of-get_tty_driver.patch
euleroswander 0898adc167 Backport upstream patches.
1. fix the null pointer of get_tty_driver.
2. criu files Dont cache fd ids for device files.
3. pre dump call vmsplice with SPLICE_F_GIFT.

Signed-off-by: euleroswander <314264452@qq.com>
2022-11-22 16:16:02 +08:00

36 lines
1.1 KiB
Diff

From 485a83c110bef1b2700acec0bd63bad4518aa62f Mon Sep 17 00:00:00 2001
From: "fu.lin" <fulin10@huawei.com>
Date: Fri, 17 Sep 2021 17:16:48 +0800
Subject: [PATCH] tty: fix the null pointer of get_tty_driver
v2: split error checking from index variable initialization
v3: use PRIx64 for printing dev_t
Signed-off-by: fu.lin <fulin10@huawei.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: He Wenliang <hewenliang4@huawei.com>
---
criu/tty.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/criu/tty.c b/criu/tty.c
index 1598ad956..1462193c5 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -1977,6 +1977,12 @@ static int dump_one_tty(int lfd, u32 id, const struct fd_parms *p)
pr_info("Dumping tty %d with id %#x\n", lfd, id);
driver = get_tty_driver(p->stat.st_rdev, p->stat.st_dev);
+ if (driver == NULL) {
+ pr_err("Unable to find a tty driver (rdev %#" PRIx64 " dev %#" PRIx64 ")\n", p->stat.st_rdev,
+ p->stat.st_dev);
+ return -1;
+ }
+
if (driver->fd_get_index)
index = driver->fd_get_index(lfd, p);
else
--
2.33.0