linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] crypto: fix missing unlock on error in sun4i_hash()
@ 2016-08-18 22:42 Wei Yongjun
  2016-08-19  5:40 ` Corentin LABBE
  2016-08-20 10:48 ` [PATCH -next v2] crypto: sun4i-ss - " Wei Yongjun
  0 siblings, 2 replies; 5+ messages in thread
From: Wei Yongjun @ 2016-08-18 22:42 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---
 drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
index 2ee3b59..de66f47 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
@@ -245,6 +245,7 @@ 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);
+			spin_unlock(&ss->slock);
 			return -EINVAL;
 		}
 	} else {

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH -next] crypto: fix missing unlock on error in sun4i_hash()
  2016-08-18 22:42 [PATCH -next] crypto: fix missing unlock on error in sun4i_hash() Wei Yongjun
@ 2016-08-19  5:40 ` Corentin LABBE
  2016-08-20 10:48 ` [PATCH -next v2] crypto: sun4i-ss - " Wei Yongjun
  1 sibling, 0 replies; 5+ messages in thread
From: Corentin LABBE @ 2016-08-19  5:40 UTC (permalink / raw)
  To: linux-arm-kernel

On 19/08/2016 00:42, 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>
> ---
>  drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
> index 2ee3b59..de66f47 100644
> --- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
> +++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c
> @@ -245,6 +245,7 @@ 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);
> +			spin_unlock(&ss->slock);
>  			return -EINVAL;
>  		}
>  	} else {
> 

Hello

Thanks for the finding, but it is better in that case to use the goto release_ss since it need also to stop the device.

Regards

LABBE Corentin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH -next v2] crypto: sun4i-ss - fix missing unlock on error in sun4i_hash()
  2016-08-18 22:42 [PATCH -next] crypto: fix missing unlock on error in sun4i_hash() Wei Yongjun
  2016-08-19  5:40 ` Corentin LABBE
@ 2016-08-20 10:48 ` Wei Yongjun
  2016-08-23 13:54   ` Corentin LABBE
  2016-08-24 13:14   ` Herbert Xu
  1 sibling, 2 replies; 5+ messages in thread
From: Wei Yongjun @ 2016-08-20 10:48 UTC (permalink / raw)
  To: linux-arm-kernel

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 */

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH -next v2] crypto: sun4i-ss - fix missing unlock on error in sun4i_hash()
  2016-08-20 10:48 ` [PATCH -next v2] crypto: sun4i-ss - " Wei Yongjun
@ 2016-08-23 13:54   ` Corentin LABBE
  2016-08-24 13:14   ` Herbert Xu
  1 sibling, 0 replies; 5+ messages in thread
From: Corentin LABBE @ 2016-08-23 13:54 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH -next v2] crypto: sun4i-ss - fix missing unlock on error in sun4i_hash()
  2016-08-20 10:48 ` [PATCH -next v2] crypto: sun4i-ss - " Wei Yongjun
  2016-08-23 13:54   ` Corentin LABBE
@ 2016-08-24 13:14   ` Herbert Xu
  1 sibling, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2016-08-24 13:14 UTC (permalink / raw)
  To: linux-arm-kernel

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.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-24 13:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-18 22:42 [PATCH -next] crypto: fix missing unlock on error in sun4i_hash() Wei Yongjun
2016-08-19  5:40 ` Corentin LABBE
2016-08-20 10:48 ` [PATCH -next v2] crypto: sun4i-ss - " Wei Yongjun
2016-08-23 13:54   ` Corentin LABBE
2016-08-24 13:14   ` Herbert Xu

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).