From d53393a044ecd010076eb0be8b1990efb5ffb7a7 Mon Sep 17 00:00:00 2001 From: Jack Morgenstein Date: Sun, 30 Aug 2009 17:24:07 +0300 Subject: [PATCH] sdp: check if sdp device is actually present in sdp_remove_one 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 --- drivers/infiniband/ulp/sdp/sdp_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/ulp/sdp/sdp_main.c b/drivers/infiniband/ulp/sdp/sdp_main.c index 5498cc4ab1701..5ed6e751e05fc 100644 --- a/drivers/infiniband/ulp/sdp/sdp_main.c +++ b/drivers/infiniband/ulp/sdp/sdp_main.c @@ -2594,6 +2594,8 @@ kill_socks: write_unlock(&device_removal_lock); 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); -- 2.51.0