Re: [PATCH v2 2/2] crypto: af_alg - add async support to algif_aead

From: Herbert Xu
Date: Thu Mar 10 2016 - 05:54:28 EST


On Mon, Feb 01, 2016 at 11:17:35AM -0800, Tadeusz Struk wrote:
>
> @@ -240,6 +255,7 @@ static int aead_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
> if (!aead_writable(sk)) {
> /* user space sent too much data */
> aead_put_sgl(sk);
> + aead_reset_ctx(ctx);

It seems that every call to aead_put_sgl is followed by a call to
aead_reset_ctx. So how about calling the latter from aead_put_sgl
directly?

> + while (atomic_read(&sk->sk_refcnt) != 0 && ctr++ < 10)
> + msleep(100);
>
> + WARN_ON(atomic_read(&sk->sk_refcnt) != 0);

The whole point of using sock_hold is to get rid of the wait so
why is this still needed?

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