2011-01-31 07:55:37

by Mohammed Shafi Shajakhan

[permalink] [raw]
Subject: [PATCH] ath9k: Fix memory leak due to failed PAPRD frames

From: Mohammed Shafi Shajakhan <[email protected]>

free the skb's when the Tx of PAPRD frames fails and also add a debug
message indicating that.

Signed-off-by: Mohammed Shafi Shajakhan <[email protected]>
---
drivers/net/wireless/ath/ath9k/main.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 20c70ba..1447b55 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -331,6 +331,8 @@ static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int
{
struct ieee80211_hw *hw = sc->hw;
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
+ struct ath_hw *ah = sc->sc_ah;
+ struct ath_common *common = ath9k_hw_common(ah);
struct ath_tx_control txctl;
int time_left;

@@ -348,8 +350,12 @@ static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int
init_completion(&sc->paprd_complete);
sc->paprd_pending = true;
txctl.paprd = BIT(chain);
- if (ath_tx_start(hw, skb, &txctl) != 0)
+
+ if (ath_tx_start(hw, skb, &txctl) != 0) {
+ ath_dbg(common, ATH_DBG_XMIT, "PAPRD TX failed\n");
+ dev_kfree_skb_any(skb);
return false;
+ }

time_left = wait_for_completion_timeout(&sc->paprd_complete,
msecs_to_jiffies(ATH_PAPRD_TIMEOUT));
--
1.7.0.4



2011-01-31 18:43:24

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH] ath9k: Fix memory leak due to failed PAPRD frames

On Sun, Jan 30, 2011 at 11:55 PM, Mohammed Shafi Shajakhan
<[email protected]> wrote:
> From: Mohammed Shafi Shajakhan <[email protected]>
>
> free the skb's when the Tx of PAPRD frames fails and also add a debug
> message indicating that.
>
> Signed-off-by: Mohammed Shafi Shajakhan <[email protected]>

Is this a stable fix?

Luis

2011-02-01 04:42:06

by Mohammed Shafi Shajakhan

[permalink] [raw]
Subject: Re: [PATCH] ath9k: Fix memory leak due to failed PAPRD frames

On Tuesday 01 February 2011 12:13 AM, Luis R. Rodriguez wrote:
> On Sun, Jan 30, 2011 at 11:55 PM, Mohammed Shafi Shajakhan
> <[email protected]> wrote:
>
>> From: Mohammed Shafi Shajakhan<[email protected]>
>>
>> free the skb's when the Tx of PAPRD frames fails and also add a debug
>> message indicating that.
>>
>> Signed-off-by: Mohammed Shafi Shajakhan<[email protected]>
>>
> Is this a stable fix?
>
No Luis, this problem came from some recent changes in PAPRD before that
it was Ok.
> Luis
>

2011-02-01 15:05:07

by Mohammed Shafi Shajakhan

[permalink] [raw]
Subject: Re: [PATCH] ath9k: Fix memory leak due to failed PAPRD frames

On Tuesday 01 February 2011 07:35 PM, John W. Linville wrote:
> On Tue, Feb 01, 2011 at 10:11:54AM +0530, Mohammed Shafi wrote:
>
>> On Tuesday 01 February 2011 12:13 AM, Luis R. Rodriguez wrote:
>>
>>> On Sun, Jan 30, 2011 at 11:55 PM, Mohammed Shafi Shajakhan
>>> <[email protected]> wrote:
>>>
>>>> From: Mohammed Shafi Shajakhan<[email protected]>
>>>>
>>>> free the skb's when the Tx of PAPRD frames fails and also add a debug
>>>> message indicating that.
>>>>
>>>> Signed-off-by: Mohammed Shafi Shajakhan<[email protected]>
>>>>
>>> Is this a stable fix?
>>>
>> No Luis, this problem came from some recent changes in PAPRD before
>> that it was Ok.
>>
> The patch applied to wireless-2.6 without changes, and the error
> handling for ath_tx_start matched existing usage. So, I have it
> queued now in wireless-2.6 with an added "Cc: [email protected]".
>
> Should I not?
>
John this will be applicable for only 2.6.38 stable kernel.
The issue fixes for 2.6.37-rc5+ and this problem is not handled in the
following commit id:

commit 7607cbe2ad6931400c5d15ced342ab329ab8f92c
Date: Mon Dec 13 08:40:52 2010 +0100

This will not be even applicable for 2.6.37. It will introduce a
regression of double freeing skb's.

thanks,
shafi


> John
>

2011-02-01 14:15:13

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH] ath9k: Fix memory leak due to failed PAPRD frames

On Tue, Feb 01, 2011 at 10:11:54AM +0530, Mohammed Shafi wrote:
> On Tuesday 01 February 2011 12:13 AM, Luis R. Rodriguez wrote:
> >On Sun, Jan 30, 2011 at 11:55 PM, Mohammed Shafi Shajakhan
> ><[email protected]> wrote:
> >>From: Mohammed Shafi Shajakhan<[email protected]>
> >>
> >>free the skb's when the Tx of PAPRD frames fails and also add a debug
> >>message indicating that.
> >>
> >>Signed-off-by: Mohammed Shafi Shajakhan<[email protected]>
> >Is this a stable fix?
> No Luis, this problem came from some recent changes in PAPRD before
> that it was Ok.

The patch applied to wireless-2.6 without changes, and the error
handling for ath_tx_start matched existing usage. So, I have it
queued now in wireless-2.6 with an added "Cc: [email protected]".

Should I not?

John
--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.