diff options
| author | Ashwini Patil <c_apati@qti.qualcomm.com> | 2016-05-13 16:18:42 +0530 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-05-25 05:00:38 -0700 |
| commit | 525abd2adec7a4ba4ad1c6e12ad2f4e44b0a62a3 (patch) | |
| tree | 0690b1eeae6632c46a372bd507fa0e4897232fa6 | |
| parent | e049874543b454b4378285fdfb1979a6dc80e8e3 (diff) | |
qcacld-2.0: Avoid dereferencing of NULL pointer
nlmsg_put returns NULL if the tailroom of the skb is insufficient
to store the message header and payload. So, add a NULL check, to
avoid possible dereferencing of NULL pointer.
Change-Id: I2dade8ba5c1ddfc104a478822de3e9e543f6b1c7
CRs-Fixed: 1015267
| -rw-r--r-- | CORE/UTILS/FWLOG/dbglog_host.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/CORE/UTILS/FWLOG/dbglog_host.c b/CORE/UTILS/FWLOG/dbglog_host.c index a1ba79c0c8b6..4d1fdbc34aaa 100644 --- a/CORE/UTILS/FWLOG/dbglog_host.c +++ b/CORE/UTILS/FWLOG/dbglog_host.c @@ -1670,6 +1670,12 @@ send_fw_diag_nl_data(const u_int8_t *buffer, return -1; } nlh = nlmsg_put(skb_out, 0, 0, WLAN_NL_MSG_CNSS_DIAG, msg_len, 0); + if (nlh == NULL) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, + ("%s: nlmsg_put failed\n", __func__)); + nlmsg_free(skb_out); + return -ENOMEM; + } wnl = (tAniNlHdr *)nlh; wnl->radio = radio; @@ -1719,6 +1725,12 @@ send_diag_netlink_data(const u_int8_t *buffer, A_UINT32 len, A_UINT32 cmd) } nlh = nlmsg_put(skb_out, 0, 0, WLAN_NL_MSG_CNSS_DIAG, slot_len, 0); + if (nlh == NULL) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, + ("%s: nlmsg_put failed\n", __func__)); + nlmsg_free(skb_out); + return -ENOMEM; + } wnl = (tAniNlHdr *)nlh; wnl->radio = radio; @@ -1777,6 +1789,12 @@ dbglog_process_netlink_data(wmi_unified_t wmi_handle, const u_int8_t *buffer, } nlh = nlmsg_put(skb_out, 0, 0, WLAN_NL_MSG_CNSS_DIAG, slot_len, 0); + if (nlh == NULL) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, + ("%s: nlmsg_put failed\n", __func__)); + nlmsg_free(skb_out); + return -ENOMEM; + } wnl = (tAniNlHdr *)nlh; wnl->radio = radio; |
