diff options
author | Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> | 2012-02-10 10:10:33 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2012-02-28 02:45:51 -0500 |
commit | 5378f244b677f6696ca8a9a467cef16cd399b0e2 (patch) | |
tree | 6ebe47b91d8078594923bad607b98c0c82248fe0 | |
parent | bd5b5ac2873da5a153fa32ff58d2fc4e25f7bc8a (diff) |
ath6kl: Fix memory leak of rx packets in endpoint 0
htc_packet and htc_packet->buf_start are separately allocated
for endpoint 0. This is different for other endpoints where
packets are allocated as skb where htc_packet is skb->head
and they are freed properly. Free htc_packet and htc_packet->buf_start
separatly for endpoint 0.
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/htc.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/htc.c b/drivers/net/wireless/ath/ath6kl/htc.c index 920e7c07fd4f..c6f45a744d52 100644 --- a/drivers/net/wireless/ath/ath6kl/htc.c +++ b/drivers/net/wireless/ath/ath6kl/htc.c | |||
@@ -2372,7 +2372,21 @@ void ath6kl_htc_flush_rx_buf(struct htc_target *target) | |||
2372 | "htc rx flush pkt 0x%p len %d ep %d\n", | 2372 | "htc rx flush pkt 0x%p len %d ep %d\n", |
2373 | packet, packet->buf_len, | 2373 | packet, packet->buf_len, |
2374 | packet->endpoint); | 2374 | packet->endpoint); |
2375 | dev_kfree_skb(packet->pkt_cntxt); | 2375 | /* |
2376 | * packets in rx_bufq of endpoint 0 have originally | ||
2377 | * been queued from target->free_ctrl_rxbuf where | ||
2378 | * packet and packet->buf_start are allocated | ||
2379 | * separately using kmalloc(). For other endpoint | ||
2380 | * rx_bufq, it is allocated as skb where packet is | ||
2381 | * skb->head. Take care of this difference while freeing | ||
2382 | * the memory. | ||
2383 | */ | ||
2384 | if (packet->endpoint == ENDPOINT_0) { | ||
2385 | kfree(packet->buf_start); | ||
2386 | kfree(packet); | ||
2387 | } else { | ||
2388 | dev_kfree_skb(packet->pkt_cntxt); | ||
2389 | } | ||
2376 | spin_lock_bh(&target->rx_lock); | 2390 | spin_lock_bh(&target->rx_lock); |
2377 | } | 2391 | } |
2378 | spin_unlock_bh(&target->rx_lock); | 2392 | spin_unlock_bh(&target->rx_lock); |