Browse Source

qcacmn: Add debug log to trap unsuccessful dbr vaddr lookup

In direct buf rx, if physical address is not intact or
is corrupt, the dbr lookup for vaddr will fail and result
in vaddr being NULL. There is no validation for this vaddr
in the caller and hence results in NULL access in the
callstack.

Add debug log and return error status when dbr
vaddr lookup fails, which indicates that there is
corruption in paddr received and avoid NULL access.

Change-Id: I76ee300ce3e686765dd5c4ee73fa71d1735c163a
CRs-Fixed: 2748529
Rakshith Suresh Patkar 4 years ago
parent
commit
2bd4ec3c09
1 changed files with 6 additions and 0 deletions
  1. 6 0
      target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c

+ 6 - 0
target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c

@@ -1620,6 +1620,12 @@ static QDF_STATUS target_if_get_dbr_data(struct wlan_objmgr_pdev *pdev,
 	*cookie = WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA_GET(
 	*cookie = WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA_GET(
 				dbr_rsp->dbr_entries[idx].paddr_hi);
 				dbr_rsp->dbr_entries[idx].paddr_hi);
 	dbr_data->vaddr = target_if_dbr_vaddr_lookup(mod_param, paddr, *cookie);
 	dbr_data->vaddr = target_if_dbr_vaddr_lookup(mod_param, paddr, *cookie);
+
+	if (!dbr_data->vaddr) {
+		direct_buf_rx_err("dbr vaddr lookup failed, vaddr NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	dbr_data->cookie = *cookie;
 	dbr_data->cookie = *cookie;
 	dbr_data->paddr = paddr;
 	dbr_data->paddr = paddr;
 	direct_buf_rx_debug("Cookie = %d Vaddr look up = %pK",
 	direct_buf_rx_debug("Cookie = %d Vaddr look up = %pK",