]> git.baikalelectronics.ru Git - kernel.git/commit
iommu/qcom: Fix bogus detach logic
authorRobin Murphy <robin.murphy@arm.com>
Tue, 18 Feb 2020 18:12:41 +0000 (18:12 +0000)
committerJoerg Roedel <jroedel@suse.de>
Wed, 19 Feb 2020 10:55:48 +0000 (11:55 +0100)
commitcd895ba16bb5d9d184a50a637737ff32a5c6edbd
treeca7bcab187843da3d6dcf62cac5a15408c0dca49
parent59cbc40c2dd9bec58360e87566692f34073db3c1
iommu/qcom: Fix bogus detach logic

Currently, the implementation of qcom_iommu_domain_free() is guaranteed
to do one of two things: WARN() and leak everything, or dereference NULL
and crash. That alone is terrible, but in fact the whole idea of trying
to track the liveness of a domain via the qcom_domain->iommu pointer as
a sanity check is full of fundamentally flawed assumptions. Make things
robust and actually functional by not trying to be quite so clever.

Reported-by: Brian Masney <masneyb@onstation.org>
Tested-by: Brian Masney <masneyb@onstation.org>
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Fixes: 444efec0dd7b ("iommu/qcom: Add qcom_iommu")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Stephan Gerhold <stephan@gerhold.net>
Cc: stable@vger.kernel.org # v4.14+
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/qcom_iommu.c