coresight-tmc: Adds lock to avoid race condition
There can be a case of race in the call to tmc_etr_bam_disable(). The call from usb_notifier() to tmc_etr_bam_disable() is within a lock 'drvdata->mem_lock' but the call from tmc_disable is not under any lock which can lead to race. This patch adds the missing lock. CRs-Fixed: 2047196 Change-Id: I3986b498ae8e2b2ddfe8f5b3315fdefab197d11c Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
This commit is contained in:
parent
5404e35069
commit
81f3b9aab8
1 changed files with 2 additions and 1 deletions
|
@ -1018,6 +1018,7 @@ static void tmc_disable(struct tmc_drvdata *drvdata, enum tmc_mode mode)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
mutex_lock(&drvdata->mem_lock);
|
||||||
spin_lock_irqsave(&drvdata->spinlock, flags);
|
spin_lock_irqsave(&drvdata->spinlock, flags);
|
||||||
if (drvdata->reading)
|
if (drvdata->reading)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -1054,7 +1055,7 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
pm_runtime_put(drvdata->dev);
|
pm_runtime_put(drvdata->dev);
|
||||||
|
mutex_unlock(&drvdata->mem_lock);
|
||||||
dev_info(drvdata->dev, "TMC disabled\n");
|
dev_info(drvdata->dev, "TMC disabled\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue