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
This commit is contained in:
Varuneshwar Petlozu 2019-07-02 15:50:42 +05:30 • committed by nshrivas
commit f876667985

View file

@ -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;
}