lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171106144733.GA19282@redhat.com>
Date:   Mon, 6 Nov 2017 15:47:33 +0100
From:   Oleg Nesterov <oleg@...hat.com>
To:     Andrei Vagin <avagin@...nvz.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        linux-kernel@...r.kernel.org, Gargi Sharma <gs051095@...il.com>
Subject: Re: [PATCH] pid: restore the old behaviour of the ns_last_pid sysctl

On 11/03, Andrei Vagin wrote:
>
> @@ -297,8 +298,18 @@ static int pid_ns_ctl_handler(struct ctl_table *table, int write,
>  	 * it should synchronize its usage with external means.
>  	 */
>  
> -	tmp.data = &pid_ns->idr.idr_next;
> -	return proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
> +	next = idr_get_cursor(&pid_ns->idr) - 1;
> +
> +	tmp.data = &next;
> +	ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
> +	if (ret < 0)
> +		return ret;
> +
> +	if (!write)
> +		return 0;
> +
> +	idr_set_cursor(&pid_ns->idr, next + 1);
> +	return 0;

Ah yes, we should also take "write" into account, I forgot it is readable.
Can't resist, to me

	err = proc_dointvec_minmax(...);
	if (!err && write)
		idr_set_cursor(...);

	return err;

looks a bit more readable, but this is matter of taste of course.


Acked-by: Oleg Nesterov <oleg@...hat.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ