linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: "Luis R. Rodriguez" <mcgrof@gmail.com>
Cc: Ben Greear <greearb@candelatech.com>,
	linux-wireless <linux-wireless@vger.kernel.org>,
	Luis Rodriguez <Luis.Rodriguez@Atheros.com>
Subject: Re: memory clobber in rx path, maybe related to ath9k.
Date: Thu, 14 Oct 2010 15:51:50 -0700	[thread overview]
Message-ID: <20101014225150.GB15740@tux> (raw)
In-Reply-To: <AANLkTi=pp2Ob06YCi6GsR9rtRaDWPP95n2M72qWLdbwM@mail.gmail.com>

On Thu, Oct 14, 2010 at 03:35:34PM -0700, Luis R. Rodriguez wrote:
> On Thu, Oct 14, 2010 at 3:29 PM, Luis R. Rodriguez <mcgrof@gmail.com> wrote:
> > Fun enough if I just create one monitor interface and loop quickly
> > over some 2 GHz channels where I know I have traffic nearby I don't
> > see the poison. So channel changes don't seem to do much because this
> > is changing channels as fast as possible from userspace. I also can
> > confirm that I see frames from the different channels as I move along.
> 
> Even forcing a band change doesn't help trigger it with just one mon0
> and one regular device scanning in a loop;
> 
> while true; do for i in 2412 5745 2417 5745 2422 5745 2427 5745 2432
> 5745 2442; do echo $i iw dev mon0 set freq $i; done; done
> while true; do iw dev wlan0 scan; done

OK so just so you know where I'm poking, this is what I have so far. The
ath9k_hw_rxprocdesc() suggestion came from Jouni but it didn't seem to help.
I'm disabling HT as I want to rule out things step by step. I haven't yet
ruled out TX as haven't been able to trigger this poison yet just based
on monitor interfaces and no frame TX's, I needed at probe requests sent
by one STA.

So the script I used was:

#!/usr/bin/perl

use strict;

my $iw = "/usr/sbin/iw";
my $ip = "/sbin/ip";

my $phy = "phy0";
my $max = 300;
my $i;
my $cmd;

# Create stations
for ($i = 0; $i<$max; $i++) {
 runCmd("$iw phy $phy interface add mon$i type monitor");
 runCmd("$ip link set dev mon$i up");
}

sub runCmd {
 my $cmd = shift;
 print "$cmd\n";
 `$cmd`;
}

And what I have on top of my tree right now, after your two new patches:
I should note I never hit the WARN_ON() nor the printks, so that rules
those out.

diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index a4c5ed4..cd61727 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -192,6 +192,7 @@ static void setup_ht_cap(struct ath_softc *sc,
 	int i, max_streams;
 
 	ht_info->ht_supported = true;
+	ht_info->ht_supported = false;
 	ht_info->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
 		       IEEE80211_HT_CAP_SM_PS |
 		       IEEE80211_HT_CAP_SGI_40 |
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index 8c13479..a96327e 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -639,6 +639,10 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
 	if ((adsp->ds_rxstatus8 & AR_RxDone) == 0)
 		return -EINPROGRESS;
 
+	ds->ds_data = 0;
+	ds->ds_vdata = 0;
+	wmb();
+
 	ads.u.rx = adsp->u.rx;
 
 	rs->rs_status = 0;
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index bcd3892..b31b5fe 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1243,6 +1243,10 @@ static int ath9k_tx(struct ieee80211_hw *hw,
 	int padpos, padsize;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 	int qnum;
+	struct sk_buff *tmp_skb;
+
+	tmp_skb = skb_copy(skb, GFP_ATOMIC);
+	dev_kfree_skb_any(tmp_skb);
 
 	if (aphy->state != ATH_WIPHY_ACTIVE && aphy->state != ATH_WIPHY_SCAN) {
 		ath_print(common, ATH_DBG_XMIT,
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index fe73fc5..8348199 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -502,6 +502,9 @@ int ath_startrecv(struct ath_softc *sc)
 		goto start_recv;
 
 	bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list);
+	/* This is fishy, what if the bf->bf_daddr is not valid ? */
+	if (!bf->bf_daddr)
+		printk("= hah bf->bf_daddr is 0!\n");
 	ath9k_hw_putrxbuf(ah, bf->bf_daddr);
 	ath9k_hw_rxena(ah);
 
@@ -663,6 +666,12 @@ static void ath_rx_send_to_mac80211(struct ieee80211_hw *hw,
 				    struct ieee80211_rx_status *rxs)
 {
 	struct ieee80211_hdr *hdr;
+	struct sk_buff *tmp_skb;
+
+	if (1) {
+		tmp_skb = skb_copy(skb, GFP_ATOMIC);
+		dev_kfree_skb_any(tmp_skb);
+	}
 
 	hdr = (struct ieee80211_hdr *)skb->data;
 
@@ -815,11 +821,17 @@ static struct ath_buf *ath_get_next_rx_buf(struct ath_softc *sc,
 		ret = ath9k_hw_rxprocdesc(ah, tds, &trs, 0);
 		if (ret == -EINPROGRESS)
 			return NULL;
+		WARN_ON(1);
 	}
 
 	if (!bf->bf_mpdu)
 		return bf;
 
+	if (!bf->bf_buf_addr)
+		printk("bf->bf_buf_addr = 0\n");
 	/*
 	 * Synchronize the DMA transfer with CPU before
 	 * 1. accessing the frame

  parent reply	other threads:[~2010-10-14 22: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
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 [this message]
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=20101014225150.GB15740@tux \
    --to=lrodriguez@atheros.com \
    --cc=Luis.Rodriguez@Atheros.com \
    --cc=greearb@candelatech.com \
    --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).