[CRIU] [PATCH 1/2] proc_parse: handle errors for breadline()

Andrew Vagin avagin at openvz.org
Tue Apr 28 13:55:06 PDT 2015


00:03:27.746 (00.008815) Error (bfd.c:149): bfd: Error reading file: No such process

Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
 proc_parse.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/proc_parse.c b/proc_parse.c
index 44bb5b8..088e45e 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -533,6 +533,8 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list)
 		char *str;
 
 		str = breadline(&f);
+		if (IS_ERR(str))
+			goto err;
 		eof = (str == NULL);
 
 		if (!eof && !is_vma_range_fmt(str)) {
@@ -761,7 +763,13 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr)
 	if (bfdopenr(&f))
 		return -1;
 
-	while (done < 8 && (str = breadline(&f))) {
+	while (done < 8) {
+		str = breadline(&f);
+		if (str == NULL)
+			break;
+		if (IS_ERR(str))
+			goto err_parse;
+
 		if (!strncmp(str, "State:", 6)) {
 			cr->state = str[7];
 			done++;
-- 
2.1.0



More information about the CRIU mailing list