Am Dienstag, 30. Januar 2018, 09:27:04 CET schrieb Stephan Müller:
Hi,
> +/**
> + * af_alg_put_iv - release lock on IV in case CTX IV is used
> + *
> + * @sk [in] AF_ALG socket
> + */
> +void af_alg_put_iv(struct sock *sk)
> +{
> + struct alg_sock *ask = alg_sk(sk);
> + struct af_alg_ctx *ctx = ask->private;
> +
> + if (!ctx->iiv || !ctx->ivlen)
> + mutex_unlock(&ctx->ivlock);
> +}
> +EXPORT_SYMBOL_GPL(af_alg_put_iv);
Having this function implies that ctx->iiv must be set once at the beginning
and cannot be toggled for a CTX thereafter as otherwise the release of the
mutex is racy. This implies that the inline IV patch needs a slight revision
to prevent toggling the ctx->iiv value.
I will send a new revision of the inline IV and the lock context IV patch
covering this issue.
Ciao
Stephan