kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tim Chen <tim.c.chen@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Megha Dey <megha.dey@linux.intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	Greg Tucker <greg.b.tucker@intel.com>,
	Xiaodong Liu <xiaodong.liu@intel.com>,
	linux-crypto@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] crypto: sha512-mb - add some missing unlock on error
Date: Tue, 25 Apr 2017 17:37:44 +0000	[thread overview]
Message-ID: <1493141864.3209.94.camel@linux.intel.com> (raw)
In-Reply-To: <20170425091854.6fryhkc2v4tf4dnl@mwanda>

On Tue, 2017-04-25 at 12:18 +0300, Dan Carpenter wrote:
> We recently added some new locking but missed the unlocks on these
> error paths in sha512_ctx_mgr_submit().

Thanks for catching this issue.

Acked-by: Tim Chen <tim.c.chen@linux.intel.com>

> 
> Fixes: c459bd7beda0 ("crypto: sha512-mb - Protect sha512 mb ctx mgr access")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/arch/x86/crypto/sha512-mb/sha512_mb.c b/arch/x86/crypto/sha512-mb/sha512_mb.c
> index 2dd3674b5a1e..458409b7568d 100644
> --- a/arch/x86/crypto/sha512-mb/sha512_mb.c
> +++ b/arch/x86/crypto/sha512-mb/sha512_mb.c
> @@ -269,19 +269,19 @@ static struct sha512_hash_ctx
>  		 * LAST
>  		 */
>  		ctx->error = HASH_CTX_ERROR_INVALID_FLAGS;
> -		return ctx;
> +		goto unlock;
>  	}
>  
>  	if (ctx->status & HASH_CTX_STS_PROCESSING) {
>  		/* Cannot submit to a currently processing job. */
>  		ctx->error = HASH_CTX_ERROR_ALREADY_PROCESSING;
> -		return ctx;
> +		goto unlock;
>  	}
>  
>  	if ((ctx->status & HASH_CTX_STS_COMPLETE) && !(flags & HASH_FIRST)) {
>  		/* Cannot update a finished job. */
>  		ctx->error = HASH_CTX_ERROR_ALREADY_COMPLETED;
> -		return ctx;
> +		goto unlock;
>  	}
>  
>  
> @@ -363,6 +363,7 @@ static struct sha512_hash_ctx
>  	}
>  
>  	ctx = sha512_ctx_mgr_resubmit(mgr, ctx);
> +unlock:
>  	spin_unlock_irqrestore(&cstate->work_lock, irqflags);
>  	return ctx;
>  }

  reply	other threads:[~2017-04-25 17:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25  9:18 [PATCH] crypto: sha512-mb - add some missing unlock on error Dan Carpenter
2017-04-25 17:37 ` Tim Chen [this message]
2017-05-18  5:25 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1493141864.3209.94.camel@linux.intel.com \
    --to=tim.c.chen@linux.intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=fenghua.yu@intel.com \
    --cc=greg.b.tucker@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=hpa@zytor.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=megha.dey@linux.intel.com \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xiaodong.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).