[PATCH] files-reg: Return error code on unsupported file dumping attempt

Cyrill Gorcunov gorcunov at openvz.org
Thu Apr 25 04:34:12 EDT 2013


Instead of BUG_ON return verbose error.

Reported-by: Dilip Daya <dilip.daya at hp.com>
Reported-by: Andrew Vagin <avagin at parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 files-reg.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/files-reg.c b/files-reg.c
index b52fe36..986ca67 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -341,8 +341,14 @@ static int create_link_remap(char *path, int len, int lfd, u32 *idp)
 	link_name[0] = '.';
 	memcpy(link_name + 1, path, len);
 	tmp = link_name + len + 1;
+
 	while (*tmp != '/') {
-		BUG_ON(tmp == link_name);
+		if (tmp == link_name) {
+			pr_err("No directory for original file "
+			       "found in %s. Unsupported file.\n",
+				path);
+			return -1;
+		}
 		tmp--;
 	}
 
-- 
1.8.1.4


--JP+T4n/bALQSJXh8--


More information about the CRIU mailing list