From e9e2f8ea5c4c489b35ce0fb087c05ea8b3345982 Mon Sep 17 00:00:00 2001 From: Surabhi Vishnoi Date: Fri, 4 Mar 2022 11:49:53 +0530 Subject: [PATCH] qcacld-3.0: Fix null pointer dereference in bus suspend related code Fix hdd_ctx null pointer derefernce issue in hdd bus suspend related code by addition of hdd_ctx null check before its use. Change-Id: Iea92dcdf8591e61853af233f8e28fe7e0f9ec4bf CRs-Fixed: 3144126 --- core/hdd/src/wlan_hdd_driver_ops.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index d7571f95f00a..00d00218ca64 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -1210,6 +1210,8 @@ static int __wlan_hdd_bus_suspend(struct wow_enable_params wow_params) hdd_info("starting bus suspend"); hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + if (!hdd_ctx) + return -ENODEV; err = wlan_hdd_validate_context(hdd_ctx); if (0 != err) { @@ -1922,6 +1924,8 @@ static int wlan_hdd_pld_suspend(struct device *dev, struct hdd_context *hdd_ctx; hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + if (!hdd_ctx) + return -ENODEV; errno = wlan_hdd_validate_context(hdd_ctx); if (0 != errno) {