[openib-general] Re: [PATCH] umad: fix hotplug

Michael S. Tsirkin mst at mellanox.co.il
Thu Nov 3 00:30:44 PST 2005


Quoting Roland Dreier <rolandd at cisco.com>:
> 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 <mst at mellanox.co.il>

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



More information about the general mailing list