diff mbox

ath10k: free wmi mgmt event skb when parsing fails

Message ID 1433150613-5662-1-git-send-email-rmani@qti.qualcomm.com (mailing list archive)
State Not Applicable
Delegated to: Kalle Valo
Headers show

Commit Message

Raja Mani June 1, 2015, 9:23 a.m. UTC
When wmi mgmt event function fails to parse given skb,
it should be freed on failure condition to avoid memory
leaks. Found this during the code review.

Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Michal Kazior June 1, 2015, 9:34 a.m. UTC | #1
On 1 June 2015 at 11:23, Raja Mani <rmani@qti.qualcomm.com> wrote:
> When wmi mgmt event function fails to parse given skb,
> it should be freed on failure condition to avoid memory
> leaks. Found this during the code review.
>
> Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>
> ---
>  drivers/net/wireless/ath/ath10k/wmi.c |    1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
> index b892eb8..818bd25 100644
> --- a/drivers/net/wireless/ath/ath10k/wmi.c
> +++ b/drivers/net/wireless/ath/ath10k/wmi.c
> @@ -2089,6 +2089,7 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
>         ret = ath10k_wmi_pull_mgmt_rx(ar, skb, &arg);
>         if (ret) {
>                 ath10k_warn(ar, "failed to parse mgmt rx event: %d\n", ret);
> +               dev_kfree_skb(skb);
>                 return ret;
>         }

Good catch! Looks good to me.


Micha?
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kalle Valo June 9, 2015, 10:52 a.m. UTC | #2
Raja Mani <rmani@qti.qualcomm.com> writes:

> When wmi mgmt event function fails to parse given skb,
> it should be freed on failure condition to avoid memory
> leaks. Found this during the code review.
>
> Signed-off-by: Raja Mani <rmani@qti.qualcomm.com>

Thanks, applied.
diff mbox

Patch

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index b892eb8..818bd25 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2089,6 +2089,7 @@  int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)
 	ret = ath10k_wmi_pull_mgmt_rx(ar, skb, &arg);
 	if (ret) {
 		ath10k_warn(ar, "failed to parse mgmt rx event: %d\n", ret);
+		dev_kfree_skb(skb);
 		return ret;
 	}