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] [day] [month] [year] [list]
Date:   Sat, 11 Nov 2017 00:51:48 +0100
From:   "Luis R. Rodriguez" <mcgrof@...nel.org>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        akpm@...ux-foundation.org
Cc:     mcgrof@...nel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] umh: Optimize 'proc_cap_handler()'

On Fri, Oct 20, 2017 at 09:33:31PM +0200, Christophe JAILLET wrote:
> If 'write' is 0, we can avoid a call to spin_lock/spin_unlock.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>

Thanks for the patch!

Acked-by: Luis R. Rodriguez <mcgrof@...nel.org>

I'll bounce a copy to Andrew for integration next.

  Luis


> ---
>  kernel/umh.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/umh.c b/kernel/umh.c
> index 6ff9905250ff..18e5fa4b0e71 100644
> --- a/kernel/umh.c
> +++ b/kernel/umh.c
> @@ -537,14 +537,14 @@ static int proc_cap_handler(struct ctl_table *table, int write,
>  	/*
>  	 * Drop everything not in the new_cap (but don't add things)
>  	 */
> -	spin_lock(&umh_sysctl_lock);
>  	if (write) {
> +		spin_lock(&umh_sysctl_lock);
>  		if (table->data == CAP_BSET)
>  			usermodehelper_bset = cap_intersect(usermodehelper_bset, new_cap);
>  		if (table->data == CAP_PI)
>  			usermodehelper_inheritable = cap_intersect(usermodehelper_inheritable, new_cap);
> +		spin_unlock(&umh_sysctl_lock);
>  	}
> -	spin_unlock(&umh_sysctl_lock);
>  
>  	return 0;
>  }
> -- 
> 2.14.1
> 
> 

-- 
Luis Rodriguez, SUSE LINUX GmbH
Maxfeldstrasse 5; D-90409 Nuernberg

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ