Преглед на файлове

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 години
родител
ревизия
6da4954462
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  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));