mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: linux-kernel@vger.kernel.org, jgarzik@pobox.com
Subject: [patch] 2.4.26-pre1 - drivers/net/r8169.c
Date: Thu, 26 Feb 2004 01:06:01 +0100	[thread overview]
Message-ID: <20040226010601.A11789@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <Pine.LNX.4.58L.0402251605360.5003@logos.cnet>; from marcelo.tosatti@cyclades.com on Wed, Feb 25, 2004 at 04:09:20PM -0300

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

Marcelo Tosatti <marcelo.tosatti@cyclades.com> :
[...]
> Here goes -pre1.

Please apply attached patch.

Without patch, bogus descriptors are parsed as soon as
tp->cur_tx%NUM_TX_DESC + (tp->cur_tx - tp->dirty_tx) > NUM_TX_DESC
(assume for instance tp->dirty_tx = NUM_TX_DESC/2,
tp->cur_tx = NUM_TX_DESC - 1 and watch entry go beyond NUM_TX_DESC).

Missing stats update is fixed by the patch btw.

--
Ueimor

[-- Attachment #2: r8169-tx-desc-overflow.patch --]
[-- Type: text/plain, Size: 955 bytes --]

--- drivers/net/r8169.c.orig	2004-02-25 23:34:15.000000000 +0100
+++ drivers/net/r8169.c	2004-02-25 23:47:26.000000000 +0100
@@ -874,7 +874,6 @@ rtl8169_tx_interrupt(struct net_device *
 		     void *ioaddr)
 {
 	unsigned long dirty_tx, tx_left = 0;
-	int entry = tp->cur_tx % NUM_TX_DESC;
 
 	assert(dev != NULL);
 	assert(tp != NULL);
@@ -884,14 +883,18 @@ rtl8169_tx_interrupt(struct net_device *
 	tx_left = tp->cur_tx - dirty_tx;
 
 	while (tx_left > 0) {
+		int entry = dirty_tx % NUM_TX_DESC;
+
 		if ((tp->TxDescArray[entry].status & OWNbit) == 0) {
-			dev_kfree_skb_irq(tp->
-					  Tx_skbuff[dirty_tx % NUM_TX_DESC]);
-			tp->Tx_skbuff[dirty_tx % NUM_TX_DESC] = NULL;
+			struct sk_buff *skb = tp->Tx_skbuff[entry];
+
+			tp->stats.tx_bytes += skb->len >= ETH_ZLEN ?
+					      skb->len : ETH_ZLEN;
 			tp->stats.tx_packets++;
+			dev_kfree_skb_irq(skb);
+			tp->Tx_skbuff[entry] = NULL;
 			dirty_tx++;
 			tx_left--;
-			entry++;
 		}
 	}
 

  reply	other threads:[~2004-02-26  0:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-25 19:09 Linux 2.4.26-pre1 Marcelo Tosatti
2004-02-26  0:06 ` Francois Romieu [this message]
2004-02-26  6:19   ` [patch] 2.4.26-pre1 - drivers/net/r8169.c Jeff Garzik
2004-02-26 21:27 ` 2.4.26-pre1: SCTP compile error Adrian Bunk
2004-02-26 23:53   ` Sridhar Samudrala
2004-02-27  1:41     ` Sridhar Samudrala
2004-02-27  6:49     ` David S. Miller

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=20040226010601.A11789@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.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

all inboxes | Powered by JetHome®