Skip to contentSkip to conversation

gpu: host1x: Check whether size of unpin isn't 0

PATCH Applied Dmitry Osipenko 2 participants 2 messages Jul 6, 2018 – Jul 9, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpu: host1x: Check whether size of unpin isn't 0

Only gather pins are mapped by the Host1x driver, regular BO relocations are not. Check whether size of unpin isn't 0, otherwise IOVA allocation at 0x0 could be erroneously released.

---
 drivers/gpu/host1x/job.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/host1x/job.c +2 -1
index e2f4a4d93d20..527a1cddb14f 100644
@@ -569,7 +569,8 @@ void host1x_job_unpin(struct host1x_job *job)
 	for (i = 0; i < job->num_unpins; i++) {
 		struct host1x_job_unpin_data *unpin = &job->unpins[i];
 
-		if (!IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL) && host->domain) {
+		if (!IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL) &&
+		    unpin->size && host->domain) {
 			iommu_unmap(host->domain, job->addr_phys[i],
 				    unpin->size);
 			free_iova(&host->iova,
Signature · 1 line
2.18.0
#1 lore raw
Quoted 8 lines · Dmitry Osipenko

Only gather pins are mapped by the Host1x driver, regular BO relocations are not. Check whether size of unpin isn't 0, otherwise IOVA allocation at 0x0 could be erroneously released.

---
 drivers/gpu/host1x/job.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Applied to drm/tegra/fixes, thanks.

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel