ath9k_htc: Fix memory leak
PATCH 1/1 ath9k_htc: Fix memory leak
From: Sujith Manoharan <[email protected]>
SKBs that are allocated in the HTC layer do not have callbacks registered and hence ended up not being freed, Fix this by freeing them properly in the TX completion routine.
--- drivers/net/wireless/ath/ath9k/htc_hst.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath9k/htc_hst.c +2 -0
@@ -344,6 +344,8 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, endpoint->ep_callbacks.tx (endpoint->ep_callbacks.priv, skb, htc_hdr->endpoint_id, txok); + }else { +kfree_skb (skb); } }
Signature · 1 line
1.8.1
Quoted 6 lines · Sujith Manoharan
From: Sujith Manoharan <[email protected]>
SKBs that are allocated in the HTC layer do not have callbacks registered and hence ended up not being freed, Fix this by freeing them properly in the TX completion routine.
Quoted 6 lines
Cc <[email protected]>Reported-by Larry Finger <[email protected]>Signed-off-by Sujith Manoharan <[email protected]>--- drivers/net/wireless/ath/ath9k/htc_hst.c | 2 ++ 1 file changed, 2 insertions(+)
Yes, your fix handles the normal case, and you can add a
I still have one remaining question. It is possible for the timeout code in htc_config_pipe_credits() to be executed, as shown below:
time_left = wait_for_completion_timeout(&target->cmd_wait, HZ);
if (!time_left) {
dev_err(target->dev, "HTC credit config timeout\n");
return -ETIMEDOUT;
}When this timeout happens, is the skb leaked?
Larry
Quoted 2 lines · Larry Finger
Yes, your fix handles the normal case, and you can add a
Tested-by Larry Finger <[email protected]>
Thanks.
Quoted 10 lines
I still have one remaining question. It is possible for the timeout code in
htc_config_pipe_credits()to be executed, as shown below:time_left = wait_for_completion_timeout(&target->cmd_wait, HZ); if (!time_left) { dev_err(target->dev, "HTC credit config timeout\n"); return -ETIMEDOUT; }When this timeout happens, is the skb leaked?
No, the submitted SKB (via htc_issue_send()) will always have a TX completion invocation. The actual completion of target->cmd_wait happens via a different code-path, htc_process_conn_rsp() in ath9k_htc_rx_msg().
Sujith