From patchwork Fri Jul 6 18:02:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 10513711 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DB8386032A for ; Mon, 9 Jul 2018 07:09:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9E6728A3D for ; Mon, 9 Jul 2018 07:09:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE57028A40; Mon, 9 Jul 2018 07:09:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8B5CF28A3D for ; Mon, 9 Jul 2018 07:09:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7B82C6E393; Mon, 9 Jul 2018 07:06:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 091A96F0F1 for ; Fri, 6 Jul 2018 18:03:01 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id p10-v6so4351113ljg.2 for ; Fri, 06 Jul 2018 11:03:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XOZa5hKvxAW/UgmrkQW2urno3LmKuo+j1r+oyBj68g8=; b=j3s39rJ2x+5m9nqHjRjwXSxboOBq1Cb0W+JASD4WWVNwzaokYlIN948kUQ05GMlExH WwD+vXEQ9zZlVW48AVH/gfrcDPKwYN1aUgptQeLdbQuqtFzuryua2Wz3wL/ToFpwbr33 ZY56qyN0awZLsTBG17JMPqpRtpCbgk1nrdBbMD5Qb3FIv5pVuPIJQ3ypE/BdwKjbWhYE Ln/TUGvpQQtx4VQ6fp7yn+l/ImGXoYs3hqASlFfVPCAtq7M/t4YbxZlyr9Bcd5cqbZzZ z0e4pgWSIFl2D3QlulO/Fy+aJNz9sNzUC6vKQj+62sWhVnkYNc+HnKdxGXjwecJd6Ne9 7DgA== X-Gm-Message-State: APt69E3KbBDU+JY3xcNBFMtnXvDv/CS3kt5EPzR35u1XghVMgDHHk8ym GsgGkN+U6K+CfgM0KiiVEHM= X-Google-Smtp-Source: AAOMgpd016s9H5uWPda4IvZyEB90BbOTzyx23gxKUzLoZA912VKGoVd4nK39TAR8mccpUAHhjjLh2w== X-Received: by 2002:a2e:658d:: with SMTP id e13-v6mr7384197ljf.57.1530900179524; Fri, 06 Jul 2018 11:02:59 -0700 (PDT) Received: from localhost.localdomain (109-252-91-84.nat.spd-mgts.ru. [109.252.91.84]) by smtp.gmail.com with ESMTPSA id j12-v6sm2304692lfg.42.2018.07.06.11.02.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Jul 2018 11:02:58 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding Subject: [PATCH] gpu: host1x: Check whether size of unpin isn't 0 Date: Fri, 6 Jul 2018 21:02:36 +0300 Message-Id: <20180706180236.27896-1-digetx@gmail.com> X-Mailer: git-send-email 2.18.0 X-Mailman-Approved-At: Mon, 09 Jul 2018 07:06:43 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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,