[PATCH] files: Make sure at least one \Slash is present in regular file path

Cyrill Gorcunov gorcunov at openvz.org
Mon Apr 29 18:14:11 EDT 2013


We don't support yet special files such as refs to /proc/self/ns/
entries, so report an error if one is being dumped.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 files-reg.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/files-reg.c b/files-reg.c
index b52fe36..8aae4aa 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -449,6 +449,14 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p)
 	pr_info("Dumping path for %d fd via self %d [%s]\n",
 			p->fd, lfd, path);
 
+	/*
+	 * The regular path we can handle should start with slash.
+	 */
+	if (!index(path, '/')) {
+		pr_err("The path [%s] is not supported\n", path);
+		return -1;
+	}
+
 	if (check_path_remap(rpath, len, &p->stat, lfd, id))
 		return -1;
 
-- 
1.8.1.4


--Bu8it7iiRSEf40bY--


More information about the CRIU mailing list