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

Tycho Andersen tycho.andersen at canonical.com
Mon Dec 7 06:51:28 PST 2015


On Mon, Dec 07, 2015 at 01:19:24PM +0300, Andrey Ryabinin wrote:
> 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>

Acked-by: Tycho Andersen <tycho.andersen at canonical.com>

Whoops, thanks.

> ---
>  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