]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iommu/amd/pgtbl_v2: Improve error handling
authorVasant Hegde <vasant.hegde@amd.com>
Thu, 27 Feb 2025 16:23:16 +0000 (16:23 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:12:51 +0000 (11:12 +0200)
[ Upstream commit 36a1cfd497435ba5e37572fe9463bb62a7b1b984 ]

Return -ENOMEM if v2_alloc_pte() fails to allocate memory.

Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20250227162320.5805-4-vasant.hegde@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/amd/io_pgtable_v2.c

index c616de2c5926ec837557afdccb76a015e439b939..a56a27396305910775c337674e94d855d4045293 100644 (file)
@@ -254,7 +254,7 @@ static int iommu_v2_map_pages(struct io_pgtable_ops *ops, unsigned long iova,
                pte = v2_alloc_pte(cfg->amd.nid, pgtable->pgd,
                                   iova, map_size, gfp, &updated);
                if (!pte) {
-                       ret = -EINVAL;
+                       ret = -ENOMEM;
                        goto out;
                }