linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [cryptodev PATCH] qat: fix bad unlock balance
@ 2014-10-15 18:33 Bruce Allan
  2014-10-24 14:54 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Bruce Allan @ 2014-10-15 18:33 UTC (permalink / raw)
  To: linux-crypto; +Cc: tadeusz.struk, herbert, davem, qat-linux

The mutex table_lock is unlocked in two functions without first being locked.
Fix the functions to properly protect the accel_table with the table_lock.

Also, fix a spelling error in one of the function's header comment.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
---

 drivers/crypto/qat/qat_common/adf_dev_mgr.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/qat/qat_common/adf_dev_mgr.c b/drivers/crypto/qat/qat_common/adf_dev_mgr.c
index ae71555..4a0a829d 100644
--- a/drivers/crypto/qat/qat_common/adf_dev_mgr.c
+++ b/drivers/crypto/qat/qat_common/adf_dev_mgr.c
@@ -129,12 +129,13 @@ struct adf_accel_dev *adf_devmgr_get_first(void)
  * Function returns acceleration device associated with the given pci device.
  * To be used by QAT device specific drivers.
  *
- * Return: pinter to accel_dev or NULL if not found.
+ * Return: pointer to accel_dev or NULL if not found.
  */
 struct adf_accel_dev *adf_devmgr_pci_to_accel_dev(struct pci_dev *pci_dev)
 {
 	struct list_head *itr;
 
+	mutex_lock(&table_lock);
 	list_for_each(itr, &accel_table) {
 		struct adf_accel_dev *ptr =
 				list_entry(itr, struct adf_accel_dev, list);
@@ -144,6 +145,7 @@ struct adf_accel_dev *adf_devmgr_pci_to_accel_dev(struct pci_dev *pci_dev)
 			return ptr;
 		}
 	}
+	mutex_unlock(&table_lock);
 	return NULL;
 }
 EXPORT_SYMBOL_GPL(adf_devmgr_pci_to_accel_dev);
@@ -152,6 +154,7 @@ struct adf_accel_dev *adf_devmgr_get_dev_by_id(uint32_t id)
 {
 	struct list_head *itr;
 
+	mutex_lock(&table_lock);
 	list_for_each(itr, &accel_table) {
 		struct adf_accel_dev *ptr =
 				list_entry(itr, struct adf_accel_dev, list);
@@ -161,6 +164,7 @@ struct adf_accel_dev *adf_devmgr_get_dev_by_id(uint32_t id)
 			return ptr;
 		}
 	}
+	mutex_unlock(&table_lock);
 	return NULL;
 }
 

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

* Re: [cryptodev PATCH] qat: fix bad unlock balance
  2014-10-15 18:33 [cryptodev PATCH] qat: fix bad unlock balance Bruce Allan
@ 2014-10-24 14:54 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2014-10-24 14:54 UTC (permalink / raw)
  To: Bruce Allan; +Cc: linux-crypto, tadeusz.struk, davem, qat-linux

On Wed, Oct 15, 2014 at 11:33:15AM -0700, Bruce Allan wrote:
> The mutex table_lock is unlocked in two functions without first being locked.
> Fix the functions to properly protect the accel_table with the table_lock.
> 
> Also, fix a spelling error in one of the function's header comment.
> 
> Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>

Applied.
-- 
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] 2+ messages in thread

end of thread, other threads:[~2014-10-24 14:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-15 18:33 [cryptodev PATCH] qat: fix bad unlock balance Bruce Allan
2014-10-24 14:54 ` 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).