dmaengine: bcm-sba-raid: serialize dma_cookie_complete() using reqs_lock
authorAnup Patel <anup.patel@broadcom.com>
Tue, 3 Oct 2017 05:22:57 +0000 (10:52 +0530)
committerVinod Koul <vinod.koul@intel.com>
Mon, 23 Oct 2017 06:05:47 +0000 (11:35 +0530)
As-per documentation in driver/dma/dmaengine.h, the
dma_cookie_complete() API should be called with lock
held.

This patch ensures that Broadcom SBA RAID driver calls
the dma_cookie_complete() API with reqs_lock held.

Signed-off-by: Anup Patel <anup.patel@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Scott Branden <scott.branden@broadcom.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/bcm-sba-raid.c

index 6c2c44724637282d9b5b5d1a27bca0b1a1b164b0..15c558508345a30a1168af55bebda470e3af2678 100644 (file)
@@ -442,7 +442,9 @@ static void sba_process_received_request(struct sba_device *sba,
 
                WARN_ON(tx->cookie < 0);
                if (tx->cookie > 0) {
+                       spin_lock_irqsave(&sba->reqs_lock, flags);
                        dma_cookie_complete(tx);
+                       spin_unlock_irqrestore(&sba->reqs_lock, flags);
                        dmaengine_desc_get_callback_invoke(tx, NULL);
                        dma_descriptor_unmap(tx);
                        tx->callback = NULL;