From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5CC83ED3B2; Tue, 21 Jul 2026 19:24:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784661886; cv=none; b=VSc2evAF1XePSidtVmHC/nZ5kx3IuZgugFvAslNWebF/2DJrlf1NGEyvOZI1aVDz+FJteeKVyL4ffQVMLJTdAp8zx78pgfm9nEdhXuCADGGbZr/teSTOodBHzDLgrkEg1+jKrpb3jcmRU4o7NvOxgRWr7MlVbQrheTfTh9UWPKk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784661886; c=relaxed/simple; bh=EUgI3hz5DBMCEBqrAjUakwbW70YjGj8l1zHb2dWmqXg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=irL6HHuajwboxCjhRs+R2Donj3R9XxDdHAqPMGoiIAVmU5I1jfCvD1m0gyBlW06SdGDqSSUpnaGx0/hIxBdReCJVrEGN/syalHQVFxlwfbgulYwR3zDIiL6WVfIgIoP42AwHbfKAcuIdAWd84mba706CUwk/TsQ70g+/CqPqRrY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=InqVIcjs; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="InqVIcjs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD9381F00ACA; Tue, 21 Jul 2026 19:24:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784661884; bh=FEPMsu/F7b5qeO4BnaDC5sse7kdXhpYLJYDNB+70K0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=InqVIcjsmAq+FGwoJSZrqQI0uHJ7uDLnS/lxHmeU5XaaNxHU726TIPrMc9eNvv+Uh RWQz8T4vTsTQeLrnSGXDdVx1O+CEbEvMOHzAPWmEfioNDH6TXCvMLwcGiEL1mBGXK6 gU58UkO3zNeDTn21c20/yOFWytAJ3IkI7DmutVG4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mikko Perttunen , Thierry Reding , Sasha Levin Subject: [PATCH 6.12 0181/1276] drm/tegra: Fix iommu_map_sgtable() return value check Date: Tue, 21 Jul 2026 17:10:24 +0200 Message-ID: <20260721152450.145108574@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152446.065700225@linuxfoundation.org> References: <20260721152446.065700225@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mikko Perttunen [ Upstream commit b3f349517de8f4469c385ebb7bfdfcc148790c0f ] Commit "iommu: return full error code from iommu_map_sg[_atomic]()" changed iommu_map_sgtable() to return an ssize_t and negative values in error cases, rather than a size_t and a zero. Update tegra_bo_iommu_map() to correctly check for errors from iommu_map_sgtable. Fixes: ad8f36e4b6b1 ("iommu: return full error code from iommu_map_sg[_atomic]()") Signed-off-by: Mikko Perttunen Signed-off-by: Thierry Reding Link: https://patch.msgid.link/20260421-iommu_map_sgtable-return-v1-2-fb484c07d2a1@nvidia.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/tegra/gem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index bf1fc5988ecb72..59c574a87c6f5f 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c @@ -234,6 +234,7 @@ static const struct host1x_bo_ops tegra_bo_ops = { static int tegra_bo_iommu_map(struct tegra_drm *tegra, struct tegra_bo *bo) { int prot = IOMMU_READ | IOMMU_WRITE; + ssize_t size; int err; if (bo->mm) @@ -255,13 +256,15 @@ static int tegra_bo_iommu_map(struct tegra_drm *tegra, struct tegra_bo *bo) bo->iova = bo->mm->start; - bo->size = iommu_map_sgtable(tegra->domain, bo->iova, bo->sgt, prot); - if (!bo->size) { + size = iommu_map_sgtable(tegra->domain, bo->iova, bo->sgt, prot); + if (size < 0) { dev_err(tegra->drm->dev, "failed to map buffer\n"); - err = -ENOMEM; + err = size; goto remove; } + bo->size = size; + mutex_unlock(&tegra->mm_lock); return 0; -- 2.53.0