Skip to content

Commit 5941f0e

Browse files
tzukueiwilldeacon
authored andcommitted
iommu/arm-smmu-v3: Fix error check in arm_smmu_alloc_cd_tables
In arm_smmu_alloc_cd_tables(), the error check following the dma_alloc_coherent() for cd_table->l2.l1tab incorrectly tests cd_table->l2.l2ptrs. This means an allocation failure for l1tab goes undetected, causing the function to return 0 (success) erroneously. Correct the check to test cd_table->l2.l1tab. Fixes: e3b1be2 ("iommu/arm-smmu-v3: Reorganize struct arm_smmu_ctx_desc_cfg") Signed-off-by: Daniel Mentz <danielmentz@google.com> Signed-off-by: Ryan Huang <tzukui@google.com> Reviewed-by: Nicolin Chen <nicolinc@nvidia.com> Reviewed-by: Pranjal Shrivastava <praan@google.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Will Deacon <will@kernel.org>
1 parent 617937d commit 5941f0e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,7 @@ static int arm_smmu_alloc_cd_tables(struct arm_smmu_master *master)
14641464
cd_table->l2.l1tab = dma_alloc_coherent(smmu->dev, l1size,
14651465
&cd_table->cdtab_dma,
14661466
GFP_KERNEL);
1467-
if (!cd_table->l2.l2ptrs) {
1467+
if (!cd_table->l2.l1tab) {
14681468
ret = -ENOMEM;
14691469
goto err_free_l2ptrs;
14701470
}

0 commit comments

Comments
 (0)