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:	Wed, 07 Apr 2010 16:49:12 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	David Howells <dhowells@...hat.com>
Cc:	torvalds@...l.org, akpm@...ux-foundation.org,
	keyrings@...ux-nfs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KEYS: Fix an RCU warning

Le mercredi 07 avril 2010 à 15:14 +0100, David Howells a écrit :
> Fix the following RCU warning:

> 
> Signed-off-by: David Howells <dhowells@...hat.com>
> ---
> 
>  security/keys/request_key.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/security/keys/request_key.c b/security/keys/request_key.c
> index 03fe63e..544e932 100644
> --- a/security/keys/request_key.c
> +++ b/security/keys/request_key.c
> @@ -112,10 +112,13 @@ static int call_sbin_request_key(struct key_construction *cons,
>  	if (cred->tgcred->process_keyring)
>  		prkey = cred->tgcred->process_keyring->serial;
>  
> -	if (cred->tgcred->session_keyring)
> +	if (cred->tgcred->session_keyring) {
> +		rcu_read_lock();
>  		sskey = rcu_dereference(cred->tgcred->session_keyring)->serial;
> -	else
> +		rcu_read_unlock();
> +	} else {
>  		sskey = cred->user->session_keyring->serial;
> +	}
>  
>  	sprintf(keyring_str[2], "%d", sskey);
>  

This fix is really wrong David.



You should instead do :

rcu_read_lock();
skeyring = rcu_dereference(cred->tgcred->session_keyring);
if (skeyring)
	sskey = sskeyring->serial;
else
	sskey = cred->user->session_keyring->serial;
rcu_read_unlock();



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ