[CRIU] [PATCH 18/27] seccomp: Don't use BUG_ON in dump_seccomp_filters

Cyrill Gorcunov gorcunov at openvz.org
Thu Mar 1 15:41:40 MSK 2018


From: Cyrill Gorcunov <gorcunov at virtuozzo.com>

Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
---
 criu/seccomp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/criu/seccomp.c b/criu/seccomp.c
index 76b0acdf9372..a4304e645de7 100644
--- a/criu/seccomp.c
+++ b/criu/seccomp.c
@@ -252,7 +252,12 @@ static int dump_seccomp_filters(void)
 			continue;
 
 		for (chain = entry->chain; chain; chain = chain->prev) {
-			BUG_ON(img_filter_pos >= nr_chains);
+			if (img_filter_pos >= nr_chains) {
+				pr_err("Unexpected position %zu > %zu\n",
+				       img_filter_pos, nr_chains);
+				xfree(se.seccomp_filters);
+				return -1;
+			}
 
 			se.seccomp_filters[img_filter_pos] = &chain->filter;
 			if (chain != entry->chain) {
-- 
2.14.3



More information about the CRIU mailing list