[openib-general] [PATCH] Fix GFP mask inside spinlock

Roland Dreier roland at topspin.com
Mon Oct 25 13:22:05 PDT 2004


add_mad_reg_req() is called with a spinlock held, so it has to
allocate with GFP_ATOMIC.  (It might be better to reorganize the code
so the allocation can happen outside the lock but I didn't attempt that)

Index: linux-kernel/infiniband/core/ib_mad.c
===================================================================
--- linux-kernel.orig/infiniband/core/ib_mad.c	2004-10-25 12:16:15.000000000 -0700
+++ linux-kernel/infiniband/core/ib_mad.c	2004-10-25 13:19:32.000000000 -0700
@@ -597,7 +597,7 @@
 	class = &private->version[mad_reg_req->mgmt_class_version];
 	if (!*class) {
 		/* Allocate management class table for "new" class version */
-		*class = kmalloc(sizeof **class, GFP_KERNEL);
+		*class = kmalloc(sizeof **class, GFP_ATOMIC);
 		if (!*class) {
 			printk(KERN_ERR PFX "No memory for "
 			       "ib_mad_mgmt_class_table\n");



More information about the general mailing list