From 3acd66498f6d4f436ea9fc7438fe85db355e907b Mon Sep 17 00:00:00 2001 From: Vevek Venkatesan Date: Tue, 28 Apr 2020 20:35:37 +0530 Subject: [PATCH] qcacld-3.0: add NULL check before soc dereference This is to fix the error of missing soc NULL check. Before dereferencing soc for decoding pdev handle, add the NULL check for soc. Change-Id: Idade64fd88790e9a6faffceb99fc42dcd683677d CRs-Fixed: 2668317 --- core/dp/txrx/ol_txrx_event.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/dp/txrx/ol_txrx_event.c b/core/dp/txrx/ol_txrx_event.c index 7960607ec6340..d9ff0c30fe818 100644 --- a/core/dp/txrx/ol_txrx_event.c +++ b/core/dp/txrx/ol_txrx_event.c @@ -72,20 +72,23 @@ wdi_event_handler(enum WDI_EVENT event, uint32_t event_index; wdi_event_subscribe *wdi_sub; struct ol_txrx_soc_t *soc = cds_get_context(QDF_MODULE_ID_SOC); - ol_txrx_pdev_handle txrx_pdev = - ol_txrx_get_pdev_from_pdev_id(soc, pdev_id); + ol_txrx_pdev_handle txrx_pdev; /* * Input validation */ if (!event) { - QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, - "Invalid WDI event in %s\n", __func__); + ol_txrx_err("Invalid WDI event"); return; } + if (!soc) { + ol_txrx_err("Invalid soc"); + return; + } + + txrx_pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id); if (!txrx_pdev) { - QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, - "Invalid pdev in WDI event handler\n"); + ol_txrx_err("Invalid pdev"); return; } /*