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

Amir Vadai amirv at mellanox.co.il
Wed Sep 2 06:39:22 PDT 2009


done

Amir Vadai
Software Eng.
Mellanox Technologies
mailto: amirv at mellanox.co.il
Tel +972-3-6259539

On 08/30/2009 05:24 PM, Jack Morgenstein wrote:
> 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);
>  
> _______________________________________________
> ewg mailing list
> ewg at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ewg



More information about the ewg mailing list