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]
Date:   Wed, 8 Jul 2020 09:38:52 +1000
From:   Herbert Xu <herbert@...dor.apana.org.au>
To:     Pavel Machek <pavel@...x.de>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Brian Moyles <bmoyles@...flix.com>,
        Mauricio Faria de Oliveira <mfo@...onical.com>
Subject: Re: [PATCH 4.19 13/36] crypto: af_alg - fix use-after-free in
 af_alg_accept() due to bh_lock_sock()

On Tue, Jul 07, 2020 at 11:25:31PM +0200, Pavel Machek wrote:
>
> > @@ -308,12 +302,14 @@ int af_alg_accept(struct sock *sk, struc
> >  
> >  	sk2->sk_family = PF_ALG;
> >  
> > -	if (nokey || !ask->refcnt++)
> > +	if (atomic_inc_return_relaxed(&ask->refcnt) == 1)
> >  		sock_hold(sk);
> > -	ask->nokey_refcnt += nokey;
> > +	if (nokey) {
> > +		atomic_inc(&ask->nokey_refcnt);
> > +		atomic_set(&alg_sk(sk2)->nokey_refcnt, 1);
> > +	}
> 
> Should we set the nokey_refcnt to 0 using atomic_set, too?
> Aternatively, should the nokey_refcnt be initialized using
> ATOMIC_INIT()?

What are you asking for? It's already being set with atomic_set.
Or are you asking it to be set to 0 instead of 1? No it needs to
be 1 for the socket destructor.

Cheers,
-- 
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ