linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
To: linux-kernel@vger.kernel.org
Subject: [patch] 2.4.0: defxx oopses upon insmod if short on memory
Date: Mon, 8 Jan 2001 20:27:09 +0100 (MET)	[thread overview]
Message-ID: <Pine.GSO.3.96.1010108200812.23234Z-100000@delta.ds2.pg.gda.pl> (raw)

Hi,

 Is there anyone maintaining defxx these days?

 The defxx driver does a null pointer derefence if a system is short on
memory.  This happens repeatably on a 32MB machine if fsck is run just
befor loading the driver (not an unusual event upon startup and a quite
nasty one).

 The driver should check for a null pointer, obviously and the following
patch does.  Anyway, as the driver allocates quite an amount of memory
chances are it will fail to get it so I decided to call schedule() so that
temporary buffers might get freed.  Otherwise chances are it would never
succeed on a busy system.  It succeeds after ~50 iterations on my system.

 If anyone has a better idea, I would be pleased to hear it.

  Maciej

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

patch-2.4.0-defxx-1
diff -up --recursive --new-file linux-2.4.0.macro/drivers/net/defxx.c linux-2.4.0/drivers/net/defxx.c
--- linux-2.4.0.macro/drivers/net/defxx.c	Tue Sep  5 19:57:51 2000
+++ linux-2.4.0/drivers/net/defxx.c	Sun Jan  7 22:56:21 2001
@@ -2709,7 +2709,10 @@ static void dfx_rcv_init(DFX_board_t *bp
 			struct sk_buff *newskb;
 			bp->descr_block_virt->rcv_data[i+j].long_0 = (u32) (PI_RCV_DESCR_M_SOP |
 				((PI_RCV_DATA_K_SIZE_MAX / PI_ALIGN_K_RCV_DATA_BUFF) << PI_RCV_DESCR_V_SEG_LEN));
-			newskb = dev_alloc_skb(NEW_SKB_SIZE);
+			while (!(newskb = dev_alloc_skb(NEW_SKB_SIZE))) {
+				printk(KERN_WARNING "%s: Could not allocate receive buffer.\n", bp->dev->name);
+				schedule();
+			}
 			/*
 			 * align to 128 bytes for compatibility with
 			 * the old EISA boards.

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

             reply	other threads:[~2001-01-08 19:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-08 19:27 Maciej W. Rozycki [this message]
2001-01-08 20:15 ` [patch] 2.4.0: defxx oopses upon insmod if short on memory Alan Cox
2001-01-08 20:35   ` Maciej W. Rozycki

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=Pine.GSO.3.96.1010108200812.23234Z-100000@delta.ds2.pg.gda.pl \
    --to=macro@ds2.pg.gda.pl \
    --cc=linux-kernel@vger.kernel.org \
    /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).