Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3aa95eca authored by Muluhe's avatar Muluhe Committed by Mulu He
Browse files

coresight: etr: Lock mismatch in ETR



In some corner condition,unlock crash happen in mutex.

Change-Id: If4246dc2538ced46d1b78db97f502cc3ba80ebbe
Signed-off-by: default avatarMulu He <muluhe@codeaurora.org>
parent b2bdf7dc
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -376,10 +376,10 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev)
	 * If we don't have a buffer release the lock and allocate memory.
	 * Otherwise keep the lock and move along.
	 */
	mutex_lock(&drvdata->mem_lock);
	spin_lock_irqsave(&drvdata->spinlock, flags);
	if (!drvdata->vaddr) {
		spin_unlock_irqrestore(&drvdata->spinlock, flags);
		mutex_lock(&drvdata->mem_lock);

		if (drvdata->out_mode == TMC_ETR_OUT_MODE_MEM) {
			/*
@@ -417,9 +417,6 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev)

	if (drvdata->reading) {
		ret = -EBUSY;
		spin_unlock_irqrestore(&drvdata->spinlock, flags);
		mutex_unlock(&drvdata->mem_lock);
		return ret;
		goto out;
	}

@@ -518,6 +515,7 @@ static void tmc_disable_etr_sink(struct coresight_device *csdev)
	spin_lock_irqsave(&drvdata->spinlock, flags);
	if (drvdata->reading) {
		spin_unlock_irqrestore(&drvdata->spinlock, flags);
		mutex_unlock(&drvdata->mem_lock);
		return;
	}