[CRIU] [PATCH] sysctl: really skip missing entries in __nonuserns_sysctl_op()

Andrey Ryabinin aryabinin at virtuozzo.com
Mon Dec 7 02:19:24 PST 2015


When __nonuserns_sysctl_op() hits non-existing it goes to the next
iteration without updating 'req' pointer. Thus it continuously tries
to open non-exitsting entry until breaking out of loop.
We should go to the next sysctl instead.

Fixes: f79f4546cfc0 ("sysctl: move sysctl calls to usernsd")
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 sysctl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sysctl.c b/sysctl.c
index f3ff175..7149376 100644
--- a/sysctl.c
+++ b/sysctl.c
@@ -362,8 +362,10 @@ static int __nonuserns_sysctl_op(struct sysctl_req *req, size_t nr_req, int op)
 
 		fd = openat(dir, req->name, flags);
 		if (fd < 0) {
-			if (errno == ENOENT && (req->flags & CTL_FLAGS_OPTIONAL))
+			if (errno == ENOENT && (req->flags & CTL_FLAGS_OPTIONAL)) {
+				req++;
 				continue;
+			}
 			pr_perror("Can't open sysctl %s", req->name);
 			goto out;
 		}
-- 
2.4.10



More information about the CRIU mailing list