crypto: tegra-aes: schedule single work handler
Amit Kamath [Thu, 29 Mar 2012 05:48:07 +0000 (10:48 +0530)]
Multiple queue were getting scheduled leading to race condition.

Bug 955259

Change-Id: I7dd8d0d15b17552c3a611449642439ae21fa4b5d
Signed-off-by: Amit Kamath <akamath@nvidia.com>
Reviewed-on: http://git-master/r/93097
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Gerrit_Virtual_Submit
Reviewed-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-by: Sanjay Singh Rawat <srawat@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>

drivers/crypto/tegra-aes.c

index 459b0a3..8d85f89 100644 (file)
@@ -882,15 +882,18 @@ static int tegra_aes_crypt(struct ablkcipher_request *req, unsigned long mode)
 
        spin_lock_irqsave(&dd->lock, flags);
        err = ablkcipher_enqueue_request(&dd->queue, req);
-       bsev_busy = test_and_set_bit(FLAGS_BUSY, &dd->bsev.busy);
-       bsea_busy = test_and_set_bit(FLAGS_BUSY, &dd->bsea.busy);
        spin_unlock_irqrestore(&dd->lock, flags);
-
-       if (!bsev_busy)
+       bsev_busy = test_and_set_bit(FLAGS_BUSY, &dd->bsev.busy);
+       if (!bsev_busy) {
                queue_work(bsev_wq, &bsev_work);
+               goto finish;
+       }
+
+       bsea_busy = test_and_set_bit(FLAGS_BUSY, &dd->bsea.busy);
        if (!bsea_busy)
                queue_work(bsea_wq, &bsea_work);
 
+finish:
        return err;
 }