alloc_skb cannot be called with GFP_DMA

Andrea Arcangeli (andrea@suse.de)
Sun, 5 Aug 2001 17:53:34 +0200


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/