linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Raja Mani <rmani@qca.qualcomm.com>
To: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Cc: <kvalo@qca.qualcomm.com>, <linux-wireless@vger.kernel.org>,
	<ath6kl-devel@qualcomm.com>
Subject: Re: [PATCH 2/2] ath6kl: Fix memory leak of rx packets in endpoint 0
Date: Tue, 14 Feb 2012 12:53:51 +0530	[thread overview]
Message-ID: <4F3A0C07.5030508@qca.qualcomm.com> (raw)
In-Reply-To: <1328886633-2823-2-git-send-email-vthiagar@qca.qualcomm.com>

On Friday 10 February 2012 08:40 PM, Vasanthakumar Thiagarajan wrote:
> 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>
> ---
>   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 c703ef9..e50cc8e 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)
>   				   "htc rx flush pkt 0x%p  len %d  ep %d\n",
>   				   packet, packet->buf_len,
>   				   packet->endpoint);
> -			dev_kfree_skb(packet->pkt_cntxt);
> +			/*
> +			 * packets in rx_bufq of endpoint 0 have originally
> +			 * been queued from target->free_ctrl_rxbuf where
> +			 * packet and packet->buf_start are allocated
> +			 * separately using kmalloc(). For other endpoint
> +			 * rx_bufq, it is allocated as skb where packet is
> +			 * skb->head. Take care of this difference while freeing
> +			 * the memory.
> +			 */
> +			if (packet->endpoint == ENDPOINT_0) {
> +				kfree(packet->buf_start);
> +				kfree(packet);
> +			} else {
> +				dev_kfree_skb(packet->pkt_cntxt);
> +			}

Vasanth,

My system is freezing with this patch when i tried to unload
ath6kl_sdio.ko. Could you double check this change once again?

>   			spin_lock_bh(&target->rx_lock);
>   		}
>   		spin_unlock_bh(&target->rx_lock);

  reply	other threads:[~2012-02-14  7:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-10 15:10 [PATCH 1/2] ath6kl: Make sure to allocate rx buffers after the endpoint connection Vasanthakumar Thiagarajan
2012-02-10 15:10 ` [PATCH 2/2] ath6kl: Fix memory leak of rx packets in endpoint 0 Vasanthakumar Thiagarajan
2012-02-14  7:23   ` Raja Mani [this message]
2012-02-14  7:27     ` Vasanthakumar Thiagarajan
2012-02-14 13:56       ` Vasanthakumar Thiagarajan
2012-02-27 17:22   ` Kalle Valo
2012-02-28  4:26     ` Vasanthakumar Thiagarajan
2012-02-28  7:41       ` Kalle Valo
2012-02-28  7:50 ` [PATCH 1/2] ath6kl: Make sure to allocate rx buffers after the endpoint connection Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F3A0C07.5030508@qca.qualcomm.com \
    --to=rmani@qca.qualcomm.com \
    --cc=ath6kl-devel@qualcomm.com \
    --cc=kvalo@qca.qualcomm.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=vthiagar@qca.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).