linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-kernel@vger.kernel.org
Subject: alloc_skb cannot be called with GFP_DMA
Date: Sun, 5 Aug 2001 17:53:34 +0200	[thread overview]
Message-ID: <20010805175334.E21840@athlon.random> (raw)

I think it's good idea to apply this patch to mainline:

--- 2.4.8pre4aa1/mm/slab.c.~1~	Sun Aug  5 16:46:58 2001
+++ 2.4.8pre4aa1/mm/slab.c	Sun Aug  5 17:44:09 2001
@@ -1172,7 +1172,6 @@
 
 static inline void kmem_cache_alloc_head(kmem_cache_t *cachep, int flags)
 {
-#if DEBUG
 	if (flags & SLAB_DMA) {
 		if (!(cachep->gfpflags & GFP_DMA))
 			BUG();
@@ -1180,7 +1179,6 @@
 		if (cachep->gfpflags & GFP_DMA)
 			BUG();
 	}
-#endif
 }
 
 static inline void * kmem_cache_alloc_one_tail (kmem_cache_t *cachep,


This will trap anybody trying calling alloc_skb using GFP_DMA, that
usage is illegal, it would work by luck only if _everybody_ calling
alloc_skb would be passing GFP_DMA too (because the gfp_mask is passed
to the GFP in order to get right things like GFP_WAIT) which is
obviously not the case as the skb cache is shared by everybody.

Actually such bugcheck is been triggered by an IKD user because IKD
#defines DEBUG, but I think we should enable such bugcheck it in
mainline too because it's too easy to forget about such requirement of
the slab cache.

In order to fix those bugs correctly and avoid memory corruption a new
skbuff_head_cache_isadma skb cache will be needed.

A fast grep revealed a few buggy network drivers already (of course the
bug is going to affect only ISA drivers so it's not a showstopper).

Andrea

             reply	other threads:[~2001-08-05 15:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-05 15:53 Andrea Arcangeli [this message]
2001-08-05 16:03 ` alloc_skb cannot be called with GFP_DMA Alan Cox
2001-08-05 16:16   ` Andrea Arcangeli
2001-08-05 17:18     ` kuznet
2001-08-05 18:38       ` Andrea Arcangeli
2002-09-26 21:18 Manfred Spraul

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=20010805175334.E21840@athlon.random \
    --to=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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).