diff options
| author | Alok Kumar <alokkuma@codeaurora.org> | 2018-05-11 16:51:59 +0530 |
|---|---|---|
| committer | nshrivas <nshrivas@codeaurora.org> | 2018-05-14 21:20:02 -0700 |
| commit | 714bb3124b2880fe7694d86ff06d7e2d94da3f0f (patch) | |
| tree | d3451dbbbc1e14751f1171e6cab3db4892abf016 | |
| parent | fc18a1b1dd3ccd8db4f045e8bd715f6e5614e248 (diff) | |
qcacld-3.0: Fix NULL pointer dereferencing from a call to cds_get_context
Pointer returned from a call to cds_get_context may be NULL, due to
which NULL pointer dereference issue will occur.
Add a NULL check for the pointer returned from call to cds_get_context
before dereferencing it.
Change-Id: If0764fd35304a8d2811eca4219dbcee3693d025d
CRs-Fixed: 2240582
| -rw-r--r-- | core/hdd/src/wlan_hdd_ipa.c | 13 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_tx_rx.c | 7 |
2 files changed, 19 insertions, 1 deletions
diff --git a/core/hdd/src/wlan_hdd_ipa.c b/core/hdd/src/wlan_hdd_ipa.c index e111ff6e45d3..0942d32652b6 100644 --- a/core/hdd/src/wlan_hdd_ipa.c +++ b/core/hdd/src/wlan_hdd_ipa.c @@ -1577,6 +1577,14 @@ static int hdd_ipa_wdi_conn_pipes(struct hdd_ipa_priv *hdd_ipa, qdf_device_t osdev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); int ret; + if (qdf_unlikely(NULL == osdev)) { + QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_ERROR, + "%s: osdev is NULL", __func__); + stat = QDF_STATUS_E_FAILURE; + goto fail_return; + } + + qdf_mem_zero(&hdd_ipa->cons_pipe_in, sizeof(struct ipa_wdi_in_params)); qdf_mem_zero(&hdd_ipa->prod_pipe_in, sizeof(struct ipa_wdi_in_params)); qdf_mem_zero(&pipe_in, sizeof(struct ipa_wdi_in_params)); @@ -3630,6 +3638,11 @@ static int hdd_ipa_uc_enable_pipes(struct hdd_ipa_priv *hdd_ipa) int result = 0; HDD_IPA_LOG(QDF_TRACE_LEVEL_DEBUG, "enter"); + if (qdf_unlikely(NULL == pdev)) { + HDD_IPA_LOG(QDF_TRACE_LEVEL_ERROR, "pdev is NULL"); + result = QDF_STATUS_E_FAILURE; + goto end; + } if (!hdd_ipa->ipa_pipes_down) { /* diff --git a/core/hdd/src/wlan_hdd_tx_rx.c b/core/hdd/src/wlan_hdd_tx_rx.c index 9cd46e3f1c8a..b07a7aaec412 100644 --- a/core/hdd/src/wlan_hdd_tx_rx.c +++ b/core/hdd/src/wlan_hdd_tx_rx.c @@ -816,7 +816,12 @@ static inline bool hdd_is_tx_allowed(struct sk_buff *skb, uint8_t peer_id) void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); void *peer; - QDF_ASSERT(pdev); + if (qdf_unlikely(NULL == pdev)) { + QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_ERROR, + "%s: pdev is NULL", __func__); + QDF_ASSERT(pdev); + return false; + } peer = ol_txrx_peer_find_by_local_id(pdev, peer_id); if (peer == NULL) { |
