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

Commit f2697b67 authored by Isaac J. Manjarres's avatar Isaac J. Manjarres
Browse files

iommu/arm-smmu: Fix missing power off for TCU space in testbus handling



When userspace specifies an incorrect testbus sel value, the testbus
write function immediately bails out, leaving the TCU space powered
on, which is not correct. Sanitize the testbus sel value before
programming the TCU testbus registers so that the register space is
powered on only when userspace provides a meaningful value.

Change-Id: I2c0935e056bd411d12ffdcc7d113c628e0e609d4
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent c4f993f9
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -5971,6 +5971,9 @@ static ssize_t arm_smmu_debug_tcu_testbus_sel_write(struct file *file,
	if (kstrtou64(buf, 0, &sel))
		goto invalid_format;

	if (sel != 1 && sel != 2)
		goto invalid_format;

	if (kstrtou64(comma + 1, 0, &val))
		goto invalid_format;

@@ -5982,8 +5985,6 @@ static ssize_t arm_smmu_debug_tcu_testbus_sel_write(struct file *file,
	else if (sel == 2)
		arm_smmu_debug_tcu_testbus_select(base,
				tcu_base, PTW_AND_CACHE_TESTBUS, WRITE, val);
	else
		goto invalid_format;

	arm_smmu_power_off(smmu->pwr);