[openib-general] [PATCH] ib_mad.c: Eliminate potential race condition with thread semaphore

Hal Rosenstock halr at voltaire.com
Fri Sep 10 18:37:56 PDT 2004


ib_mad.c: Eliminate potential race condition with thread semaphore

Index: ib_mad.c
===================================================================
--- ib_mad.c    (revision 781)
+++ ib_mad.c    (working copy)
@@ -700,7 +700,6 @@
        daemonize("ib_mad-%-6s-%-2d", priv->device->name, priv->port);
        unlock_kernel();
 
-       sema_init(&thread_data->sem, 0);
        while (1) {
                if (down_interruptible(&thread_data->sem)) {
                        printk(KERN_DEBUG "Exiting ib_mad thread\n");
@@ -723,6 +722,7 @@
 {
        struct ib_mad_thread_data *thread_data = &priv->thread_data;
 
+       sema_init(&thread_data->sem, 0);
        thread_data->run = 1;
        kernel_thread(ib_mad_thread, priv, 0);
 }





More information about the general mailing list