linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: "Luis R. Rodriguez" <mcgrof@gmail.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: memory clobber in rx path, maybe related to ath9k.
Date: Tue, 12 Oct 2010 12:51:35 -0700	[thread overview]
Message-ID: <4CB4BC47.7000907@candelatech.com> (raw)
In-Reply-To: <4CB4AC61.207@candelatech.com>

On 10/12/2010 11:43 AM, Ben Greear wrote:
> On 10/12/2010 11:40 AM, Luis R. Rodriguez wrote:
>> On Tue, Oct 12, 2010 at 11:35 AM, Ben Greear<greearb@candelatech.com>
>> wrote:

>>> This code looks weird to me. One of the paprd branches
>>> deletes the skb, the other doesn't appear to. Neither
>>> null out bf->bf_mpdu, which would appear to leave a dangling
>>> pointer in at least the dev_kfree_skb_any() branch.
>>>
>>> ath_tx_complete frees it's skb in all cases, so another
>>> bf->bf_mpdu dangling pointer issue.
>>>
>>> Maybe at the least we should null out bf->bf_mpdu when
>>> skb is consumed?
>>
>> You're reading my mind, that was what I was going to test today. Still
>> doing e-mail sweep though.
>
> I'm trying to put together a patch now..but the paprd branch makes
> no sense at all.
>
> Shouldn't it also free the skb in the complete(&sc->paprd_complete) branch?
> I don't see anything that uses the skb, and nothing that frees it.
>
> if (bf->bf_state.bfs_paprd) {
> if (time_after(jiffies,
> bf->bf_state.bfs_paprd_timestamp +
> msecs_to_jiffies(ATH_PAPRD_TIMEOUT)))
> dev_kfree_skb_any(skb);
> else
> complete(&sc->paprd_complete);

I tried this patch, but the memory poision warnings continue.
Might still be a useful patch though...

[greearb@build-32 mac80211]$ git diff
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 8656491..f43a004 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -398,7 +398,7 @@ void ath_paprd_calibrate(struct work_struct *work)
                                   "Timeout waiting for paprd training on "
                                   "TX chain %d\n",
                                   chain);
-                       goto fail_paprd;
+                       break;
                 }

                 if (!ar9003_paprd_is_done(ah))
@@ -416,7 +416,6 @@ void ath_paprd_calibrate(struct work_struct *work)
                 ath_paprd_activate(sc);
         }

-fail_paprd:
         ath9k_ps_restore(sc);
  }

diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 942be55..d39b4b5 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -1919,17 +1919,17 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
         dma_unmap_single(sc->dev, bf->bf_dmacontext, skb->len, DMA_TO_DEVICE);

         if (bf->bf_state.bfs_paprd) {
-               if (time_after(jiffies,
-                              bf->bf_state.bfs_paprd_timestamp +
-                              msecs_to_jiffies(ATH_PAPRD_TIMEOUT)))
-                       dev_kfree_skb_any(skb);
-               else
-                       complete(&sc->paprd_complete);
+               /* ath_paprd_calibrate owns the skb. */
+               complete(&sc->paprd_complete);
         } else {
-               ath_tx_complete(sc, skb, bf->aphy, tx_flags);
+               /* stat_tx must be called first, it references skb. */
                 ath_debug_stat_tx(sc, txq, bf, ts);
+               ath_tx_complete(sc, skb, bf->aphy, tx_flags);
         }

+       /* At this point, skb is consumed one way or another */
+       bf->bf_mpdu = NULL;
+
         /*
          * Return the list of ath_buf of this mpdu to free queue
          */


Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


  reply	other threads:[~2010-10-12 19:51 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-05 17:00 memory clobber in rx path, maybe related to ath9k Ben Greear
2010-10-05 17:16 ` Luis R. Rodriguez
2010-10-05 17:24   ` Ben Greear
2010-10-05 17:36     ` Luis R. Rodriguez
2010-10-05 17:38       ` Ben Greear
2010-10-05 17:43         ` Luis R. Rodriguez
2010-10-05 17:47           ` Ben Greear
2010-10-05 17:55             ` Luis R. Rodriguez
2010-10-05 18:14               ` Ben Greear
2010-10-05 21:12                 ` Ben Greear
2010-10-07 17:33                 ` Ben Greear
2010-10-07 18:14                   ` Johannes Berg
2010-10-07 18:29                     ` Luis R. Rodriguez
2010-10-07 18:39                       ` Ben Greear
2010-10-07 18:42                         ` Luis R. Rodriguez
2010-10-07 18:45                           ` Ben Greear
2010-10-07 19:14                             ` Ben Greear
2010-10-07 19:17                               ` Johannes Berg
2010-10-07 19:22                           ` Ben Greear
2010-10-07 19:27                             ` Johannes Berg
2010-10-07 21:31                               ` Luis R. Rodriguez
2010-10-07 21:36                                 ` Luis R. Rodriguez
2010-10-07 21:59                                   ` Luis R. Rodriguez
2010-10-11 20:51                                     ` Ben Greear
2010-10-12  1:03                                       ` Luis R. Rodriguez
2010-10-12  3:27                                         ` Ben Greear
2010-10-12  6:10                                           ` Luis R. Rodriguez
2010-10-12 18:35                                             ` Ben Greear
2010-10-12 18:40                                               ` Luis R. Rodriguez
2010-10-12 18:43                                                 ` Ben Greear
2010-10-12 19:51                                                   ` Ben Greear [this message]
2010-10-13 17:12                                                 ` Ben Greear
2010-10-13 17:29                                                   ` Luis R. Rodriguez
2010-10-13 17:48                                                     ` Ben Greear
2010-10-14 21:25                                                       ` Luis R. Rodriguez
2010-10-14 21:31                                                         ` Ben Greear
2010-10-14 21:32                                                           ` Luis R. Rodriguez
2010-10-14 21:39                                                             ` Ben Greear
2010-10-14 21:45                                                       ` Johannes Berg
2010-10-14 21:47                                                         ` Ben Greear
2010-10-13  5:31                                               ` Vasanthakumar Thiagarajan
2010-10-13 16:39                                                 ` Ben Greear
2010-10-13 19:56                                                   ` Björn Smedman
2010-10-13 20:03                                                     ` Luis R. Rodriguez
2010-10-14 19:15                                                       ` Ben Greear
2010-10-14 19:17                                                         ` Luis R. Rodriguez
2010-10-14 21:52                                                     ` Björn Smedman
2010-10-14 22:05                                                       ` Ben Greear
2010-10-14 22:16                                                         ` Luis R. Rodriguez
2010-10-14 22:29                                                           ` Luis R. Rodriguez
2010-10-14 22:35                                                             ` Luis R. Rodriguez
2010-10-14 22:44                                                               ` Ben Greear
2010-10-14 22:54                                                                 ` Luis R. Rodriguez
2010-10-14 22:51                                                               ` Luis R. Rodriguez
2010-10-14 23:19                                                                 ` Luis R. Rodriguez
2010-10-14 23:30                                                                   ` Ben Greear
2010-10-14 23:39                                                                     ` Luis R. Rodriguez
2010-10-14 23:48                                                                       ` Luis R. Rodriguez
2010-10-15 16:51                                                                         ` Ben Greear
2010-10-15 18:47                                                                           ` Luis R. Rodriguez
2010-10-15 19:36                                                                             ` Ben Greear
2010-10-15 21:07                                                                               ` Luis R. Rodriguez
2010-10-15 23:21                                                                                 ` Luis R. Rodriguez
2010-10-15 23:33                                                                                   ` Ben Greear
2010-10-15 23:38                                                                                     ` Luis R. Rodriguez
2010-10-15 23:41                                                                                       ` Luis R. Rodriguez
2010-10-16  0:07                                                                                         ` Ben Greear
2010-10-15 23:42                                                                                       ` Ben Greear
2010-10-15 23:57                                                                                         ` Luis R. Rodriguez
2010-10-17 19:44                                                                                           ` Ben Greear
2010-10-18 22:46                                                                                             ` Luis R. Rodriguez
2010-10-15 23:39                                                                                     ` Ben Greear
2010-10-14 23:51                                                                       ` Ben Greear
2010-10-14 22:47                                                       ` Ben Greear
2010-10-14 23:46                                                         ` Björn Smedman
2010-10-18 13:48                                                           ` Björn Smedman
2010-10-18 17:24                                                             ` Luis R. Rodriguez
2010-10-18 22:34                                                               ` Björn Smedman
2010-10-18 22:41                                                                 ` Luis R. Rodriguez
2010-10-14  5:37                                                   ` Vasanthakumar Thiagarajan
2010-10-07 21:52                                 ` Ben Greear
2010-10-08  0:42                               ` Bruno Randolf
2010-10-08  2:30                                 ` Ben Greear
2010-10-05 17:22 ` Johannes Berg

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=4CB4BC47.7000907@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mcgrof@gmail.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).