[PATCH 6/8] iommu/qcom: Add NULL ctx check in TLB invalidation paths
Mukesh Ojha
mukesh.ojha at oss.qualcomm.com
Wed Jun 24 12:18:09 PDT 2026
On Tue, Jun 23, 2026 at 06:08:08PM +0100, Robin Murphy wrote:
> On 23/06/2026 1:20 pm, Mukesh Ojha wrote:
> > to_ctx() returns qcom_iommu->ctxs[asid], which can be NULL if the
> > corresponding context bank failed to probe or was already removed.
> > qcom_iommu_tlb_sync(), qcom_iommu_tlb_inv_context(), and
> > qcom_iommu_tlb_inv_range_nosync() all dereference the returned pointer
> > directly, risking a NULL pointer dereference.
>
> But if there's no context bank, then how has a domain been allocated in
> order to permit io-pgtable operations that would eventually call into
> qcom_flush_ops at all? Can you please clarify whether you've actually
> observed a real-world issue here, and if so how?
You're right, I haven't observed a real crash here.
qcom_iommu_of_xlate already rejects any ASID whose ctxs[] slot is
NULL, so a domain can never be attached and therefore
qcom_flush_ops can never be reached with a NULL ctx.
I'll drop it.
--
-Mukesh Ojha
More information about the linux-arm-kernel
mailing list