[openib-general] [PATCH] [CM] add check before trying to free received MAD

Sean Hefty mshefty at ichips.intel.com
Wed Feb 16 16:18:28 PST 2005


This patch adds a check to see if a mad_recv_wc exists before a call is
made to free it.  This fixes a crash after a call is made to
ib_cm_establish.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>

Index: infiniband/core/cm.c
===================================================================
--- infiniband/core/cm.c	(revision 1809)
+++ infiniband/core/cm.c	(working copy)
@@ -579,7 +579,8 @@ static struct cm_work * cm_dequeue_work(
 
 static void cm_free_work(struct cm_work *work)
 {
-	ib_free_recv_mad(work->mad_recv_wc);
+	if (work->mad_recv_wc)
+		ib_free_recv_mad(work->mad_recv_wc);
 	kfree(work);
 }
 
@@ -2528,6 +2529,7 @@ int ib_cm_establish(struct ib_cm_id *cm_
 	INIT_WORK(&work->work, cm_work_handler, work);
 	work->local_id = cm_id->local_id;
 	work->remote_id = cm_id->remote_id;
+	work->mad_recv_wc = NULL;
 	work->cm_event.event = IB_CM_USER_ESTABLISHED;
 	queue_work(cm.wq, &work->work);
 out:



More information about the general mailing list