ath10k: prevent memory leak in wmi rx ops
authorMichal Kazior <michal.kazior@tieto.com>
Mon, 8 Jun 2015 11:23:27 +0000 (13:23 +0200)
committerKalle Valo <kvalo@qca.qualcomm.com>
Tue, 9 Jun 2015 10:49:33 +0000 (13:49 +0300)
Found during code review. This was pretty much
impossible to happen but better safe than sorry.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/wmi-tlv.c
drivers/net/wireless/ath/ath10k/wmi.c

index 563fde73623c19037be244470abc523db00df971..8fdba3865c960e699bacf0998fd911d1e3a231b1 100644 (file)
@@ -402,7 +402,7 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct sk_buff *skb)
        id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID);
 
        if (skb_pull(skb, sizeof(struct wmi_cmd_hdr)) == NULL)
-               return;
+               goto out;
 
        trace_ath10k_wmi_event(ar, id, skb->data, skb->len);
 
@@ -521,6 +521,7 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct sk_buff *skb)
                break;
        }
 
+out:
        dev_kfree_skb(skb);
 }
 
index 226bd2141629b5a9ccd0653ff6264482c0c700e2..6c046c244705fe69f23fa9207113c6cefec9a78e 100644 (file)
@@ -3223,7 +3223,7 @@ static void ath10k_wmi_op_rx(struct ath10k *ar, struct sk_buff *skb)
        id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID);
 
        if (skb_pull(skb, sizeof(struct wmi_cmd_hdr)) == NULL)
-               return;
+               goto out;
 
        trace_ath10k_wmi_event(ar, id, skb->data, skb->len);
 
@@ -3327,6 +3327,7 @@ static void ath10k_wmi_op_rx(struct ath10k *ar, struct sk_buff *skb)
                break;
        }
 
+out:
        dev_kfree_skb(skb);
 }
 
@@ -3340,7 +3341,7 @@ static void ath10k_wmi_10_1_op_rx(struct ath10k *ar, struct sk_buff *skb)
        id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID);
 
        if (skb_pull(skb, sizeof(struct wmi_cmd_hdr)) == NULL)
-               return;
+               goto out;
 
        trace_ath10k_wmi_event(ar, id, skb->data, skb->len);
 
@@ -3463,7 +3464,7 @@ static void ath10k_wmi_10_2_op_rx(struct ath10k *ar, struct sk_buff *skb)
        id = MS(__le32_to_cpu(cmd_hdr->cmd_id), WMI_CMD_HDR_CMD_ID);
 
        if (skb_pull(skb, sizeof(struct wmi_cmd_hdr)) == NULL)
-               return;
+               goto out;
 
        trace_ath10k_wmi_event(ar, id, skb->data, skb->len);
 
@@ -3571,6 +3572,7 @@ static void ath10k_wmi_10_2_op_rx(struct ath10k *ar, struct sk_buff *skb)
                break;
        }
 
+out:
        dev_kfree_skb(skb);
 }