Skip to contentSkip to conversation

ath9k_htc: Fix memory leak

PATCH In review Sujith Manoharan 2 participants 3 messages Jan 9, 2013 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

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
index 4a9570d..aac4a40 100644
@@ -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
Tested-by on v1 1/1
#1 lore raw
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
---
  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

#2 lore raw
Quoted 2 lines · Larry Finger

Yes, your fix handles the normal case, and you can add a

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