mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 21:54:34 -04:00
qcacmn: Fix memory leak for RX path of SDIO WLAN
There is a memory leak for RX path of SDIO WLAN if skb allocation fails. Add condition check and free all resources for scenario. Change-Id: Ic4a58d3d4e93f1d6d57bfb045dfdeb131b24f72a CRs-Fixed: 2128051
This commit is contained in:
parent
9f7b297a38
commit
23b6502d88
1 changed files with 23 additions and 3 deletions
|
|
@ -293,10 +293,18 @@ QDF_STATUS hif_dev_alloc_and_prepare_rx_packets(struct hif_sdio_device *pdev,
|
|||
/* for NO RESOURCE error, no need to flush data queue */
|
||||
if (QDF_IS_STATUS_ERROR(status)
|
||||
&& (status != QDF_STATUS_E_RESOURCES)) {
|
||||
while (!HTC_QUEUE_EMPTY(queue))
|
||||
while (!HTC_QUEUE_EMPTY(queue)) {
|
||||
qdf_nbuf_t netbuf;
|
||||
packet = htc_packet_dequeue(queue);
|
||||
if (packet == NULL)
|
||||
break;
|
||||
netbuf = (qdf_nbuf_t) packet->pNetBufContext;
|
||||
if (netbuf)
|
||||
qdf_nbuf_free(netbuf);
|
||||
}
|
||||
}
|
||||
|
||||
if (status == QDF_STATUS_E_RESOURCES)
|
||||
status = QDF_STATUS_SUCCESS;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -967,8 +975,20 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
|
|||
hif_dev_recv_packet(pdev, packet,
|
||||
packet->ActualLength,
|
||||
mail_box_index);
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
while (!HTC_QUEUE_EMPTY(&recv_pkt_queue)) {
|
||||
qdf_nbuf_t netbuf;
|
||||
packet =
|
||||
htc_packet_dequeue(&recv_pkt_queue);
|
||||
if (packet == NULL)
|
||||
break;
|
||||
netbuf =
|
||||
(qdf_nbuf_t) packet->pNetBufContext;
|
||||
if (netbuf)
|
||||
qdf_nbuf_free(netbuf);
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* sent synchronously, queue this packet for
|
||||
* synchronous completion
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue