]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sdp: check if sdp device is actually present in sdp_remove_one
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Sun, 30 Aug 2009 14:24:07 +0000 (17:24 +0300)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 6 Oct 2015 12:04:38 +0000 (05:04 -0700)
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@dev.mellanox.co.il>
drivers/infiniband/ulp/sdp/sdp_main.c

index 5498cc4ab170145c0b59ec0fb033fe81fe751790..5ed6e751e05fc8ddbfae899d19be616af0f2a585 100644 (file)
@@ -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);