From 2bd4ec3c090911375a59c7dda702806f63295ea0 Mon Sep 17 00:00:00 2001 From: Rakshith Suresh Patkar Date: Wed, 5 Aug 2020 13:46:44 +0530 Subject: [PATCH] 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 --- target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c index dc0f3d772cde..b2e99da459e2 100644 --- a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c +++ b/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( dbr_rsp->dbr_entries[idx].paddr_hi); 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->paddr = paddr; direct_buf_rx_debug("Cookie = %d Vaddr look up = %pK",