iommu/msm: Fix error handling in msm_iommu_unmap()
Subsystems (3)
PATCH 1/1 iommu/msm: Fix error handling in msm_iommu_unmap()
Error handling in msm_iommu_unmap() is broken. On some error conditions retval is set to a non-zero value which causes the function to return 'len' at the end. This hides the error from the user. Zero should be returned in those error cases.
--- drivers/iommu/msm_iommu.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)
drivers/iommu/msm_iommu.c +1 -6
@@ -482,23 +482,19 @@ static size_t msm_iommu_unmap(struct iommu_domain *domain, unsigned long va, priv = domain->priv; -if (!priv) { - ret = -ENODEV ; +if (!priv) goto fail; - } fl_table = priv->pgtable;if (len !=SZ_16M && len !=SZ_1M && len !=SZ_64K && len !=SZ_4K ) {pr_debug ("Bad length: %d\n" , len); - ret = -EINVAL ; goto fail; }if (!fl_table) {pr_debug ("Null page table\n" ); - ret = -EINVAL ; goto fail; }
@@ -507,7 +503,6 @@ static size_t msm_iommu_unmap(struct iommu_domain *domain, unsigned long va,if (*fl_pte ==0 ) {pr_debug ("First level PTE is 0\n" ); - ret = -ENODEV ; goto fail; }
Signature · 1 line
1.7.5.4
Quoted 6 lines · Joerg Roedel
Error handling in
msm_iommu_unmap()is broken. On some error conditions retval is set to a non-zero value which causes the function to return 'len' at the end. This hides the error from the user. Zero should be returned in those error cases.
Quoted 6 lines
Cc David Brown <[email protected]>Cc Stepan Moskovchenko <[email protected]>Signed-off-by Joerg Roedel <[email protected]>--- drivers/iommu/msm_iommu.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Quoted 7 lines · David Brown
Quoted 6 lines · Joerg Roedel
Error handling in
msm_iommu_unmap()is broken. On some error conditions retval is set to a non-zero value which causes the function to return 'len' at the end. This hides the error from the user. Zero should be returned in those error cases.
Quoted 8 lines
Quoted 6 lines
Cc David Brown <[email protected]>Cc Stepan Moskovchenko <[email protected]>Signed-off-by Joerg Roedel <[email protected]>--- drivers/iommu/msm_iommu.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)Acked-by David Brown <[email protected]>
Thanks. I'll queue this up with iommu fixes for 3.3 and mark it for stable as well.
Joerg
Signature · 5 lines
AMD Operating System Research Center Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach General Managers: Alberto Bozzo Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632