[ewg] [PATCH] sdp: check if sdp device is actually present in sdp_remove_one

Jack Morgenstein jackm at dev.mellanox.co.il
Sun Aug 30 07:24:07 PDT 2009


If sdp fails to initialize at driver startup for any reason,
the device is still registered with the ib_core, but there will be
no client data (i.e., ib_set_client_data() will not be called, and all
kernel resources are de-allocated).

On removal, ib_get_client_data() will return NULL in this case -- and this
must be tested for -- or we will get a kernel Oops for a NULL pointer
dereference.

Signed-off-by: Jack Morgenstein <jackm at dev.mellanox.co.il>

---
Amir,
Please take care of this.

Index: ofed_kernel-fixes/drivers/infiniband/ulp/sdp/sdp_main.c
===================================================================
--- ofed_kernel-fixes.orig/drivers/infiniband/ulp/sdp/sdp_main.c	2009-08-30 16:56:54.000000000 +0300
+++ ofed_kernel-fixes/drivers/infiniband/ulp/sdp/sdp_main.c	2009-08-30 16:58:08.000000000 +0300
@@ -2595,6 +2595,8 @@
 
 	sdp_dev = ib_get_client_data(device, &sdp_client);
 
+	if (!sdp_dev)
+		return;
 	ib_flush_fmr_pool(sdp_dev->fmr_pool);
 	ib_destroy_fmr_pool(sdp_dev->fmr_pool);
 



More information about the ewg mailing list