From 9e52c6925fe4108d968fc2ecd33c8a77eb0a0b8f Mon Sep 17 00:00:00 2001 From: Cheng Zeng Date: Tue, 7 Sep 2021 18:15:39 +0800 Subject: [PATCH] msm: ipa3: Fix null pointer dereference error If smmu is not enabled, smmu context device check was missing before accessing it which was resulting in null pointer dereference. Now adding check before accessing it. Change-Id: I94393524c79847a165ba605d34906525640b359a Signed-off-by: Cheng Zeng --- drivers/platform/msm/ipa/ipa_v3/ipa_nat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_nat.c b/drivers/platform/msm/ipa/ipa_v3/ipa_nat.c index 5edd4776669e..8ced02501f84 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_nat.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_nat.c @@ -179,7 +179,7 @@ static int ipa3_nat_ipv6ct_mmap( /* * Check if no smmu or non dma coherent */ - if (!cb->valid || !dev_is_dma_coherent(cb->dev)) { + if (cb && cb->dev && (!cb->valid || !dev_is_dma_coherent(cb->dev))) { IPADBG("Either smmu valid=%u and/or DMA coherent=%u false\n", cb->valid, !dev_is_dma_coherent(cb->dev));