summaryrefslogtreecommitdiff
path: root/drivers/crypto/omap-sham.c
diff options
context:
space:
mode:
authorDmitry Kasatkin <dmitry.kasatkin@nokia.com>2010-12-29 13:52:04 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2010-12-29 13:52:04 +0300
commit6c39d116ba308ccf9007773a090ca6d20eb68459 (patch)
tree4928ffd2efc23fe19431f32dfa6f188248e1d643 /drivers/crypto/omap-sham.c
parent8ad225e8e4f530f500c12ec77fd5a51caf6a2f66 (diff)
downloadlinux-6c39d116ba308ccf9007773a090ca6d20eb68459.tar.xz
crypto: omap-sham - backlog handling fix
Previous commit "removed redundant locking" introduced a bug in handling backlog. In certain cases, when async request complete callback will call complete() on -EINPROGRESS code, it will cause uncompleted requests. It does not happen in implementation similar to crypto test manager, but it will happen in implementation similar to dm-crypt. Backlog needs to be checked before dequeuing next request. Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@nokia.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/omap-sham.c')
-rw-r--r--drivers/crypto/omap-sham.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index eb988e7a2fd9..2e71123516e0 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -664,7 +664,7 @@ static void omap_sham_finish_req(struct ahash_request *req, int err)
static int omap_sham_handle_queue(struct omap_sham_dev *dd,
struct ahash_request *req)
{
- struct crypto_async_request *async_req, *backlog = 0;
+ struct crypto_async_request *async_req, *backlog;
struct omap_sham_reqctx *ctx;
struct ahash_request *prev_req;
unsigned long flags;
@@ -677,11 +677,10 @@ static int omap_sham_handle_queue(struct omap_sham_dev *dd,
spin_unlock_irqrestore(&dd->lock, flags);
return ret;
}
+ backlog = crypto_get_backlog(&dd->queue);
async_req = crypto_dequeue_request(&dd->queue);
- if (async_req) {
+ if (async_req)
dd->flags |= FLAGS_BUSY;
- backlog = crypto_get_backlog(&dd->queue);
- }
spin_unlock_irqrestore(&dd->lock, flags);
if (!async_req)