Commit 76e78a38 authored by Andrey Ryabinin's avatar Andrey Ryabinin Committed by Pavel Emelyanov

sysctl: really skip missing entries in __nonuserns_sysctl_op()

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: f79f4546 ("sysctl: move sysctl calls to usernsd")
Signed-off-by: 's avatarAndrey Ryabinin <aryabinin@virtuozzo.com>
Acked-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Acked-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 60595eb4
...@@ -362,8 +362,10 @@ static int __nonuserns_sysctl_op(struct sysctl_req *req, size_t nr_req, int op) ...@@ -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); fd = openat(dir, req->name, flags);
if (fd < 0) { if (fd < 0) {
if (errno == ENOENT && (req->flags & CTL_FLAGS_OPTIONAL)) if (errno == ENOENT && (req->flags & CTL_FLAGS_OPTIONAL)) {
req++;
continue; continue;
}
pr_perror("Can't open sysctl %s", req->name); pr_perror("Can't open sysctl %s", req->name);
goto out; goto out;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment