From 5778c1db264618d7e51ab92c794632505e34998e Mon Sep 17 00:00:00 2001 From: Sourav Mohapatra Date: Tue, 24 Sep 2019 11:11:06 +0530 Subject: [PATCH] qcacld-3.0: Prevent possible NULL pointer dereference The function wma_wake_event_piggybacked gets the pointer to pdev object by calling cds_get_context with the respective module ID. This pdev pointer is then passed on down the stack to CDP APIs where there are no explicit NULL check to validate the same. In the case the pdev is NULL, this can go on to cause a NULL pointer dereference. Add a validation check on the PDEV pointer to avoid this. Change-Id: Ifecd6853445c6df5e16e6310beb2bf7cbc6997a0 CRs-Fixed: 2524604 --- core/wma/src/wma_features.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index dcd37832c86d..53203ddac6e2 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -2422,6 +2422,11 @@ static int wma_wake_event_piggybacked( } pdev = cds_get_context(QDF_MODULE_ID_TXRX); + if (!pdev) { + WMA_LOGE("Invalid pdev"); + return -EINVAL; + } + bssid = wma_get_vdev_bssid (wma->interfaces[event_param->fixed_param->vdev_id].vdev); if (!bssid) { @@ -2429,6 +2434,7 @@ static int wma_wake_event_piggybacked( __func__, event_param->fixed_param->vdev_id); return 0; } + peer = cdp_peer_find_by_addr(soc, pdev, bssid, &peer_id); wake_reason = event_param->fixed_param->wake_reason;