From 2727866b28846928f183b261e979b44a977b55ec Mon Sep 17 00:00:00 2001 From: Vulupala Shashank Reddy Date: Tue, 14 Jul 2020 12:25:38 +0530 Subject: [PATCH] qcacld-3.0: Allocate required memory for skb and radiotap Mgmt txrx component clones skb and sends cloned skb to its clients ex: packet capture component. Need to Allocate memory and copy skb so that there is enough space to copy radiotap header in skb for packet capture mode. Free skb cloned by Mgmt txrx component. Change-Id: I6bc66b5916ec5a8cf28741e4fcb72f14650fdbfa CRs-Fixed: 2730559 --- .../core/src/wlan_pkt_capture_mgmt_txrx.c | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c b/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c index 428a8384f68c..4614814390a3 100644 --- a/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c +++ b/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c @@ -414,23 +414,41 @@ pkt_capture_mgmt_tx_completion(struct wlan_objmgr_pdev *pdev, /** * process_pktcapture_mgmt_rx_data_cb() - process management rx packets * @rx_params: mgmt rx event params - * @nbuf: netbuf + * @wbuf: netbuf * * Return: none */ static QDF_STATUS pkt_capture_mgmt_rx_data_cb(struct wlan_objmgr_psoc *psoc, struct wlan_objmgr_peer *peer, - qdf_nbuf_t nbuf, + qdf_nbuf_t wbuf, struct mgmt_rx_event_params *rx_params, enum mgmt_frame_type frm_type) { struct mon_rx_status txrx_status = {0}; struct ieee80211_frame *wh; tpSirMacFrameCtl pfc; + qdf_nbuf_t nbuf; + int buf_len; - if (!(pkt_capture_get_pktcap_mode(psoc) & PKT_CAPTURE_MODE_MGMT_ONLY)) + if (!(pkt_capture_get_pktcap_mode(psoc) & PKT_CAPTURE_MODE_MGMT_ONLY)) { + qdf_nbuf_free(wbuf); return QDF_STATUS_E_FAILURE; + } + + buf_len = qdf_nbuf_len(wbuf); + nbuf = qdf_nbuf_alloc(NULL, roundup( + buf_len + RESERVE_BYTES, 4), + RESERVE_BYTES, 4, false); + if (!nbuf) { + qdf_nbuf_free(wbuf); + return QDF_STATUS_E_FAILURE; + } + + qdf_nbuf_put_tail(nbuf, buf_len); + qdf_mem_copy(qdf_nbuf_data(nbuf), qdf_nbuf_data(wbuf), buf_len); + + qdf_nbuf_free(wbuf); pfc = (tpSirMacFrameCtl)(qdf_nbuf_data(nbuf)); wh = (struct ieee80211_frame *)qdf_nbuf_data(nbuf);