linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpu: host1x: Check whether size of unpin isn't 0
@ 2018-07-06 18:02 Dmitry Osipenko
  2018-07-09  8:31 ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Osipenko @ 2018-07-06 18:02 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-tegra, dri-devel, linux-kernel

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>
---
 drivers/gpu/host1x/job.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
index e2f4a4d93d20..527a1cddb14f 100644
--- a/drivers/gpu/host1x/job.c
+++ b/drivers/gpu/host1x/job.c
@@ -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,
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gpu: host1x: Check whether size of unpin isn't 0
  2018-07-06 18:02 [PATCH] gpu: host1x: Check whether size of unpin isn't 0 Dmitry Osipenko
@ 2018-07-09  8:31 ` Thierry Reding
  0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2018-07-09  8:31 UTC (permalink / raw)
  To: Dmitry Osipenko; +Cc: linux-tegra, dri-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]

On Fri, Jul 06, 2018 at 09:02:36PM +0300, Dmitry Osipenko wrote:
> 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>
> ---
>  drivers/gpu/host1x/job.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Applied to drm/tegra/fixes, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-09  8:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-06 18:02 [PATCH] gpu: host1x: Check whether size of unpin isn't 0 Dmitry Osipenko
2018-07-09  8:31 ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).