From: Jack Morgenstein Date: Sun, 30 Aug 2009 14:24:07 +0000 (+0300) Subject: sdp: check if sdp device is actually present in sdp_remove_one X-Git-Tag: v4.1.12-92~264^2~5^2~249 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d53393a044ecd010076eb0be8b1990efb5ffb7a7;p=users%2Fjedix%2Flinux-maple.git 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 --- 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);