public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail•com>
To: Stephen Hemminger <shemminger@vyatta•com>
Cc: David Miller <davem@davemloft•net>,
	"Berck E. Nash" <flyboy@gmail•com>,
	Mike McCormack <mikem@ring3k•org>,
	netdev@vger•kernel.org, dhazelton@enter•net, mbreuer@majjas•com
Subject: [PATCH v2] sky2: Fix oops in sky2_xmit_frame() after TX timeout
Date: Mon, 4 Jan 2010 19:48:41 +0100	[thread overview]
Message-ID: <20100104184841.GA3106@del.dom.local> (raw)
In-Reply-To: <20100104102637.16734638@nehalam>

On Mon, Jan 04, 2010 at 10:26:37AM -0800, Stephen Hemminger wrote:
> > -	if (tx_avail(sky2) > MAX_SKB_TX_LE + 4)
> > +	/* Wake unless it's detached, and called e.g. from sky2_down() */
> > +	if (tx_avail(sky2) > MAX_SKB_TX_LE + 4 &&
> > +	    likely(netif_device_present(dev)))
> >  		netif_wake_queue(dev);
> >  }
> >
> 
> The likely() seems unnecessary noise here. It can't possibly matter that
> much.

OK. Thanks,
Jarek P.
------------> (take 2)

During TX timeout procedure dev could be awoken too early, e.g. by
sky2_complete_tx() called from sky2_down(). Then sky2_xmit_frame()
can run while buffers are freed causing an oops. This patch fixes it
by adding netif_device_present() test in sky2_tx_complete().

Fixes: http://bugzilla.kernel.org/show_bug.cgi?id=14925

With debugging by: Mike McCormack <mikem@ring3k•org>

Reported-by: Berck E. Nash <flyboy@gmail•com>
Tested-by: Berck E. Nash <flyboy@gmail•com>
Signed-off-by: Jarek Poplawski <jarkao2@gmail•com>

---

 drivers/net/sky2.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 1c01b96..7650f73 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1844,7 +1844,8 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
 	sky2->tx_cons = idx;
 	smp_mb();
 
-	if (tx_avail(sky2) > MAX_SKB_TX_LE + 4)
+	/* Wake unless it's detached, and called e.g. from sky2_down() */
+	if (tx_avail(sky2) > MAX_SKB_TX_LE + 4 && netif_device_present(dev))
 		netif_wake_queue(dev);
 }
 

  reply	other threads:[~2010-01-04 18:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-31 10:55 [PATCH] sky2: Lock transmit queue while disabling device Mike McCormack
2009-12-31 15:58 ` Michael Breuer
2009-12-31 16:15   ` Daniel Hazelton
2009-12-31 16:33 ` Berck Nash
2009-12-31 18:51 ` Jarek Poplawski
2009-12-31 23:51   ` Mike McCormack
2010-01-01  3:06     ` Berck E. Nash
2010-01-01  6:42       ` Stephen Hemminger
2010-01-01 18:31     ` Jarek Poplawski
2010-01-04  2:44       ` Berck E. Nash
2010-01-04 13:49         ` [PATCH] sky2: Fix oops in sky2_xmit_frame() after TX timeout Jarek Poplawski
2010-01-04 18:26           ` Stephen Hemminger
2010-01-04 18:48             ` Jarek Poplawski [this message]
2010-01-07  4:27 ` [PATCH] sky2: Lock transmit queue while disabling device David Miller
2010-01-07  6:35   ` Jarek Poplawski
2010-01-07  8:01     ` David Miller
2010-01-07  8:15       ` Jarek Poplawski
2010-01-07  8:19         ` David Miller
2010-01-07 13:48           ` Stephen Hemminger
2010-01-07 18:08           ` Stephen Hemminger

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=20100104184841.GA3106@del.dom.local \
    --to=jarkao2@gmail$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=dhazelton@enter$(echo .)net \
    --cc=flyboy@gmail$(echo .)com \
    --cc=mbreuer@majjas$(echo .)com \
    --cc=mikem@ring3k$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=shemminger@vyatta$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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