[openib-general] [PATCH] ib_sa/multicast: Fix crash when multiple HCAs are present
Sean Hefty
sean.hefty at intel.com
Mon Jan 29 09:44:09 PST 2007
We need to use a per device event handler, rather than a single,
global handler that gets reinitialized when a new device is added
to the system.
Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
diff --git a/drivers/infiniband/core/multicast.c b/drivers/infiniband/core/multicast.c
index fde977e..039f1eb 100644
--- a/drivers/infiniband/core/multicast.c
+++ b/drivers/infiniband/core/multicast.c
@@ -51,7 +51,6 @@ static struct ib_client mcast_client = {
};
static struct ib_sa_client sa_client;
-static struct ib_event_handler event_handler;
static struct workqueue_struct *mcast_wq;
static union ib_gid mgid0;
@@ -68,6 +67,7 @@ struct mcast_port {
struct mcast_device {
struct ib_device *device;
+ struct ib_event_handler event_handler;
int start_port;
int end_port;
struct mcast_port port[0];
@@ -742,9 +742,7 @@ static void mcast_event_handler(struct ib_event_handler *handler,
{
struct mcast_device *dev;
- dev = ib_get_client_data(event->device, &mcast_client);
- if (!dev)
- return;
+ dev = container_of(handler, struct mcast_device, event_handler);
switch (event->event) {
case IB_EVENT_PORT_ERR:
@@ -793,8 +791,8 @@ static void mcast_add_one(struct ib_device *device)
dev->device = device;
ib_set_client_data(device, &mcast_client, dev);
- INIT_IB_EVENT_HANDLER(&event_handler, device, mcast_event_handler);
- ib_register_event_handler(&event_handler);
+ INIT_IB_EVENT_HANDLER(&dev->event_handler, device, mcast_event_handler);
+ ib_register_event_handler(&dev->event_handler);
}
static void mcast_remove_one(struct ib_device *device)
@@ -807,7 +805,7 @@ static void mcast_remove_one(struct ib_device *device)
if (!dev)
return;
- ib_unregister_event_handler(&event_handler);
+ ib_unregister_event_handler(&dev->event_handler);
flush_workqueue(mcast_wq);
for (i = 0; i <= dev->end_port - dev->start_port; i++) {
More information about the general
mailing list