diff mbox

[-next,v2] crypto: sun4i-ss - fix missing unlock on error in sun4i_hash()

Message ID 1471690133-24396-1-git-send-email-weiyj.lk@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Yongjun Aug. 20, 2016, 10:48 a.m. UTC
Add the missing unlock before return from function sun4i_hash()
in the error handling case.

Fixes: 477d9b2e591b ("crypto: sun4i-ss - unify update/final function")
Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
---
v1 -> v2: goto release_ss as LABBE Corentin's suggestion
---
 drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Corentin Labbe Aug. 23, 2016, 1:54 p.m. UTC | #1
On 20/08/2016 12:48, Wei Yongjun wrote:
> Add the missing unlock before return from function sun4i_hash()
> in the error handling case.
> 
> Fixes: 477d9b2e591b ("crypto: sun4i-ss - unify update/final function")
> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
> ---
> v1 -> v2: goto release_ss as LABBE Corentin's suggestion
> ---
>  drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
> index 2ee3b59..1afeb8e 100644
> --- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
> +++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
> @@ -245,7 +245,8 @@ int sun4i_hash(struct ahash_request *areq)
>  		if (end > areq->nbytes || areq->nbytes - end > 63) {
>  			dev_err(ss->dev, "ERROR: Bound error %u %u\n",
>  				end, areq->nbytes);
> -			return -EINVAL;
> +			err = -EINVAL;
> +			goto release_ss;
>  		}
>  	} else {
>  		/* Since we have the flag final, we can go up to modulo 4 */
> 

Acked-by: Corentin LABBE <clabbe.montjoie@gmail.com>

Thanks
Herbert Xu Aug. 24, 2016, 1:14 p.m. UTC | #2
On Sat, Aug 20, 2016 at 10:48:53AM +0000, Wei Yongjun wrote:
> Add the missing unlock before return from function sun4i_hash()
> in the error handling case.
> 
> Fixes: 477d9b2e591b ("crypto: sun4i-ss - unify update/final function")
> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>

Patch applied.  Thanks.
diff mbox

Patch

diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
index 2ee3b59..1afeb8e 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
@@ -245,7 +245,8 @@  int sun4i_hash(struct ahash_request *areq)
 		if (end > areq->nbytes || areq->nbytes - end > 63) {
 			dev_err(ss->dev, "ERROR: Bound error %u %u\n",
 				end, areq->nbytes);
-			return -EINVAL;
+			err = -EINVAL;
+			goto release_ss;
 		}
 	} else {
 		/* Since we have the flag final, we can go up to modulo 4 */