Selaa lähdekoodia

msm: adsprpc: To avoid null pointer dereference

To log error for fastrpc_mmap_remove_ssr and
compat_fastrpc_get_dsp_info for avoiding null pointer
dereferences leading to kw issues.

Change-Id: I515485d891331e0740722a0de1291353db645b66
Acked-by: Ansa Ahmed <[email protected]>
Signed-off-by: Vamsi Krishna Gattupalli <[email protected]>
Vamsi Krishna Gattupalli 2 vuotta sitten
vanhempi
sitoutus
27d9053c28
1 muutettua tiedostoa jossa 5 lisäystä ja 2 poistoa
  1. 5 2
      dsp/adsprpc.c

+ 5 - 2
dsp/adsprpc.c

@@ -4031,19 +4031,22 @@ static int fastrpc_init_create_static_process(struct fastrpc_file *fl,
 			err = fastrpc_mmap_create(fl, -1, NULL, 0, init->mem,
 				 init->memlen, ADSP_MMAP_REMOTE_HEAP_ADDR, &mem);
 			mutex_unlock(&fl->map_mutex);
-			if (err)
+			if (err || (!mem))
 				goto bail;
 			spin_lock_irqsave(&me->hlock, irq_flags);
 			mem->in_use = true;
 			spin_unlock_irqrestore(&me->hlock, irq_flags);
 		}
+		VERIFY(err, mem);
+		if (err)
+			goto bail;
 		phys = mem->phys;
 		size = mem->size;
 		/*
 		 * If remote-heap VMIDs are defined in DTSI, then do
 		 * hyp_assign from HLOS to those VMs (LPASS, ADSP).
 		 */
-		if (rhvm->vmid && mem && mem->refs == 1 && size) {
+		if (rhvm->vmid && mem->refs == 1 && size) {
 			u64 src_perms = BIT(QCOM_SCM_VMID_HLOS);
 			struct qcom_scm_vmperm *dst_perms;
 			uint32_t i = 0;