From f87666798573dbb18151937bff61fbaff1189ce3 Mon Sep 17 00:00:00 2001 From: Varuneshwar Petlozu Date: Tue, 2 Jul 2019 15:50:42 +0530 Subject: [PATCH] qcacld-3.0: Add null check for qdf_ctx in hdd_configure_cds Currently in function hdd_configure_cds the driver is passing the pointer from cds_get_context to ucfg_ipa_uc_ol_init without any NULL check. This pointer later then gets dereferenced which can cause null pointer dereference. To solve this, added a null check before calling ucfg_ipa_uc_ol_init Change-Id: Ie0d8e103c9eeac76d285c4b3870c3c4ea9172dc6 CRs-Fixed: 2462711 --- core/hdd/src/wlan_hdd_main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 1ac789391323..cb809eeb0e50 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -11181,6 +11181,7 @@ int hdd_configure_cds(struct hdd_context *hdd_ctx) bool value; enum pmo_auto_pwr_detect_failure_mode auto_power_fail_mode; bool bval = false; + qdf_device_t qdf_ctx; mac_handle = hdd_ctx->mac_handle; @@ -11277,8 +11278,14 @@ int hdd_configure_cds(struct hdd_context *hdd_ctx) * IPA module before configuring them to FW. Sequence required as crash * observed otherwise. */ - if (ucfg_ipa_uc_ol_init(hdd_ctx->pdev, - cds_get_context(QDF_MODULE_ID_QDF_DEVICE))) { + + qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + if (!qdf_ctx) { + hdd_err("QDF device context is NULL"); + goto out; + } + + if (ucfg_ipa_uc_ol_init(hdd_ctx->pdev, qdf_ctx)) { hdd_err("Failed to setup pipes"); goto out; }