* [PATCH 2/2] crypto: ixp4xx - Add missing npe_c release in error branches
2016-07-22 13:32 [PATCH 0/2] Fix a resource release omission in error handling code Quentin Lambert
@ 2016-07-22 13:32 ` Quentin Lambert
2016-07-22 13:32 ` [PATCH 1/2] crypto: ixp4xx - Fix a "simple if" coding style warning Quentin Lambert
2016-08-09 10:59 ` [PATCH 0/2] Fix a resource release omission in error handling code Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Quentin Lambert @ 2016-07-22 13:32 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, linux-crypto, linux-kernel
Cc: kernel-janitors, Quentin Lambert
Most error branches following the call to npe_request contain a call to
npe_request. This patch add a call to npe_release to error branches
following the call to npe_request that do not have it.
This issue was found with Hector.
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
---
If I am right in thinking that these call to npe_release are missing, another
solution would be to jump to err since the rest of the code does it.
drivers/crypto/ixp4xx_crypto.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -448,7 +448,7 @@ static int init_ixp_crypto(struct device
if (!npe_running(npe_c)) {
ret = npe_load_firmware(npe_c, npe_name(npe_c), dev);
if (ret)
- return ret;
+ goto npe_release;
if (npe_recv_message(npe_c, msg, "STATUS_MSG"))
goto npe_error;
} else {
@@ -472,7 +472,8 @@ static int init_ixp_crypto(struct device
default:
printk(KERN_ERR "Firmware of %s lacks crypto support\n",
npe_name(npe_c));
- return -ENODEV;
+ ret = -ENODEV;
+ goto npe_release;
}
/* buffer_pool will also be used to sometimes store the hmac,
* so assure it is large enough
@@ -511,6 +512,7 @@ npe_error:
err:
dma_pool_destroy(ctx_pool);
dma_pool_destroy(buffer_pool);
+npe_release:
npe_release(npe_c);
return ret;
}
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/2] crypto: ixp4xx - Fix a "simple if" coding style warning
2016-07-22 13:32 [PATCH 0/2] Fix a resource release omission in error handling code Quentin Lambert
2016-07-22 13:32 ` [PATCH 2/2] crypto: ixp4xx - Add missing npe_c release in error branches Quentin Lambert
@ 2016-07-22 13:32 ` Quentin Lambert
2016-08-09 10:59 ` [PATCH 0/2] Fix a resource release omission in error handling code Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Quentin Lambert @ 2016-07-22 13:32 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, linux-crypto, linux-kernel
Cc: kernel-janitors, Quentin Lambert
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
---
drivers/crypto/ixp4xx_crypto.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -447,9 +447,8 @@ static int init_ixp_crypto(struct device
if (!npe_running(npe_c)) {
ret = npe_load_firmware(npe_c, npe_name(npe_c), dev);
- if (ret) {
+ if (ret)
return ret;
- }
if (npe_recv_message(npe_c, msg, "STATUS_MSG"))
goto npe_error;
} else {
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 0/2] Fix a resource release omission in error handling code
2016-07-22 13:32 [PATCH 0/2] Fix a resource release omission in error handling code Quentin Lambert
2016-07-22 13:32 ` [PATCH 2/2] crypto: ixp4xx - Add missing npe_c release in error branches Quentin Lambert
2016-07-22 13:32 ` [PATCH 1/2] crypto: ixp4xx - Fix a "simple if" coding style warning Quentin Lambert
@ 2016-08-09 10:59 ` Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2016-08-09 10:59 UTC (permalink / raw)
To: Quentin Lambert
Cc: David S. Miller, linux-crypto, linux-kernel, kernel-janitors
On Fri, Jul 22, 2016 at 03:32:40PM +0200, Quentin Lambert wrote:
> The first patch is a style fix, the second add calls to npe_release.
> The reason for me thinking that they are necessary is that every other branches
> leading to an error return are calling this function.
Both patches applied. BTW, your patches came in the wrong order.
Please send them in the correct order next time.
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] 4+ messages in thread