All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
To: Kalle Valo <kvalo@qca.qualcomm.com>
Cc: <linux-wireless@vger.kernel.org>, <ath6kl-devel@qualcomm.com>
Subject: Re: [PATCH 2/2] ath6kl: Fix potential memory leak in ath6kl_tx_complete()
Date: Tue, 14 Aug 2012 10:23:03 +0530	[thread overview]
Message-ID: <20120814045302.GA4335@vasanth-laptop> (raw)
In-Reply-To: <502915C5.30503@qca.qualcomm.com>

On Mon, Aug 13, 2012 at 05:57:09PM +0300, Kalle Valo wrote:
> On 08/13/2012 04:48 PM, Vasanthakumar Thiagarajan wrote:
> > We bail out from ath6kl_tx_complete() if any of the sanity
> > checks on skb and ath6kl_cookie fails. By doing this we
> > potentially leak few remaining buffers in packet_queue.
> > Make sure to proceed processing the remaining buffers
> > as well. This issue is found during code review.
> > 
> > Reported-by: Wang yufeng <yufengw@qca.qualcomm.com>
> > Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
> > ---
> >  drivers/net/wireless/ath/ath6kl/txrx.c |   25 ++++++++++++++-----------
> >  1 files changed, 14 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/net/wireless/ath/ath6kl/txrx.c b/drivers/net/wireless/ath/ath6kl/txrx.c
> > index aab8251..4b26ba0 100644
> > --- a/drivers/net/wireless/ath/ath6kl/txrx.c
> > +++ b/drivers/net/wireless/ath/ath6kl/txrx.c
> > @@ -698,21 +698,29 @@ void ath6kl_tx_complete(struct htc_target *target,
> >  		list_del(&packet->list);
> >  
> >  		ath6kl_cookie = (struct ath6kl_cookie *)packet->pkt_cntxt;
> > -		if (!ath6kl_cookie)
> > -			goto fatal;
> > +		if (!ath6kl_cookie) {
> > +			WARN_ON(1);
> > +			continue;
> > +		}
> 
> Please use WARN_ON_ONCE() to avoid excess log messages (as this is in
> data path) and put the WARN_ON() inside if:
> 
> if (WARN_ON_ONCE(!ath6kl_cookie))
> 	continue;

Sure, thanks!.

> 
> > +		if (!skb || !skb->data) {
> > +			WARN_ON(1);
> > +			dev_kfree_skb(skb);
> > +			ath6kl_free_cookie(ar, ath6kl_cookie);
> > +			continue;
> > +		}
> 
> Same here.

Sure.

Vasanth

      reply	other threads:[~2012-08-14  4:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-13 13:48 [PATCH 1/2] ath6kl: Fix potential skb double free in ath6kl_wmi_sync_point() Vasanthakumar Thiagarajan
2012-08-13 13:48 ` [PATCH 2/2] ath6kl: Fix potential memory leak in ath6kl_tx_complete() Vasanthakumar Thiagarajan
2012-08-13 14:57   ` Kalle Valo
2012-08-14  4:53     ` Vasanthakumar Thiagarajan [this message]

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=20120814045302.GA4335@vasanth-laptop \
    --to=vthiagar@qca.qualcomm.com \
    --cc=ath6kl-devel@qualcomm.com \
    --cc=kvalo@qca.qualcomm.com \
    --cc=linux-wireless@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.