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.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
Dmitry Osipenko 2018-07-06 21:02:36 +03:00 коммит произвёл Thierry Reding
Родитель 4466b1f0e0
Коммит ec58923215
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -569,7 +569,8 @@ void host1x_job_unpin(struct host1x_job *job)
for (i = 0; i < job->num_unpins; i++) { for (i = 0; i < job->num_unpins; i++) {
struct host1x_job_unpin_data *unpin = &job->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], iommu_unmap(host->domain, job->addr_phys[i],
unpin->size); unpin->size);
free_iova(&host->iova, free_iova(&host->iova,