diff mbox

RDMA/ocrdma: Fix the driver crash during rmmod.

Message ID 88bfa9eb-4579-4394-a2ae-8ea6370c55ce@CMEXHTCAS2.ad.emulex.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

bgottumukkala@emulex.com Oct. 28, 2013, 11:36 a.m. UTC
From: Naresh Gottumukkala <bgottumukkala@emulex.com>

ocrdma_remove_free funtion can be called in a bottom-half context.
So the code in this funtion should not sleep.

Moved the resource cleanup code to ocrdma_remove instead of
ocrdma_remove_free.

Signed-off-by: Naresh Gottumukkala <bgottumukkala@emulex.com>
---
 drivers/infiniband/hw/ocrdma/ocrdma_main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index 0ce7674..91443bc 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -452,9 +452,6 @@  static void ocrdma_remove_free(struct rcu_head *rcu)
 {
 	struct ocrdma_dev *dev = container_of(rcu, struct ocrdma_dev, rcu);
 
-	ocrdma_free_resources(dev);
-	ocrdma_cleanup_hw(dev);
-
 	idr_remove(&ocrdma_dev_id, dev->id);
 	kfree(dev->mbx_cmd);
 	ib_dealloc_device(&dev->ibdev);
@@ -470,6 +467,10 @@  static void ocrdma_remove(struct ocrdma_dev *dev)
 	spin_lock(&ocrdma_devlist_lock);
 	list_del_rcu(&dev->entry);
 	spin_unlock(&ocrdma_devlist_lock);
+
+	ocrdma_free_resources(dev);
+	ocrdma_cleanup_hw(dev);
+
 	call_rcu(&dev->rcu, ocrdma_remove_free);
 }