Quoting Roland Dreier <[EMAIL PROTECTED]>:
> Subject: [PATCH] umad: fix hotplug
> 
> I just committed the patch below, which should fix hotplug handling in
> umad.  The practical effect of this that you can do "modprobe -r ib_mthca"
> with opensm running and not get an oops.
> 
> Comments and test results solicited....
> 
> Thanks,
>   Roland

I've just checked in the following obvious fix. Hope thats OK with everyone.
Committed revision 3956.

---

Protect file->mr changes by port->mutex, and remove it from port_list on close.

Signed-off-by: Michael S. Tsirkin <[EMAIL PROTECTED]>

Index: linux-kernel/drivers/infiniband/core/user_mad.c
===================================================================
--- linux-kernel/drivers/infiniband/core/user_mad.c     (revision 3955)
+++ linux-kernel/drivers/infiniband/core/user_mad.c     (working copy)
@@ -623,6 +623,7 @@ static int ib_umad_close(struct inode *i
        struct ib_umad_packet *packet, *tmp;
        int i;
 
+       down_write(&file->port->mutex);
        for (i = 0; i < IB_UMAD_MAX_AGENTS; ++i)
                if (file->agent[i]) {
                        ib_dereg_mr(file->mr[i]);
@@ -632,6 +633,9 @@ static int ib_umad_close(struct inode *i
        list_for_each_entry_safe(packet, tmp, &file->recv_list, list)
                kfree(packet);
 
+       list_del(&file->port_list);
+       up_write(&file->port->mutex);
+
        kfree(file);
 
        kref_put(&dev->ref, ib_umad_release_dev);

-- 
MST
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to