Pārlūkot izejas kodu

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: Piyush Dhyani <[email protected]>
Piyush Dhyani 4 gadi atpakaļ
vecāks
revīzija
6da4954462
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      drivers/platform/msm/ipa/ipa_v3/ipa_nat.c

+ 1 - 1
drivers/platform/msm/ipa/ipa_v3/ipa_nat.c

@@ -150,7 +150,7 @@ static int ipa3_nat_ipv6ct_mmap(
 	/*
 	 * Check if no smmu or non dma coherent
 	 */
-	if (cb && (!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));