Re: 2.2.11: Complicated memory leak...

Andrea Arcangeli (andrea@suse.de)
Thu, 12 Aug 1999 16:56:42 +0200 (CEST)


On Thu, 12 Aug 1999, David S. Miller wrote:

>@@ -982,9 +1042,9 @@
> rtl8129_rx(dev);
>
> if (status & (TxOK | TxErr)) {
>- unsigned int dirty_tx;
>+ unsigned int dirty_tx = tp->dirty_tx;
>
>- for (dirty_tx = tp->dirty_tx; dirty_tx < tp->cur_tx; dirty_tx++) {
>+ while (tp->cur_tx - dirty_tx > 0) {
> int entry = dirty_tx % NUM_TX_DESC;
> int txstatus = inl(ioaddr + TxStatus0 + entry*4);
>
>Unsigned stuff + comparisons against being negative == leak.

reading the above the fix should look like this patch:

--- 2.2.11/drivers/net/rtl8139.c Thu Aug 12 02:32:30 1999
+++ /tmp/rtl8139.c Thu Aug 12 16:54:19 1999
@@ -1044,7 +1044,7 @@
if (status & (TxOK | TxErr)) {
unsigned int dirty_tx = tp->dirty_tx;

- while (tp->cur_tx - dirty_tx > 0) {
+ while (tp->cur_tx > dirty_tx) {
int entry = dirty_tx % NUM_TX_DESC;
int txstatus = inl(ioaddr + TxStatus0 + entry*4);

Andrea

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/