[ovs-dev] [PATCH v2] datapath-windows: Proper cleanup in case of driver init failure

Ben Pfaff blp at nicira.com
Tue Sep 1 15:28:15 UTC 2015


Nithin, does this version resolve the concerns you had about v1?

Thanks,

Ben.

On Tue, Sep 01, 2015 at 02:21:09PM +0000, Sorin Vinturis wrote:
> Signed-off-by: Sorin Vinturis <svinturis at cloudbasesolutions.com>
> Acked-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
> ---
>  datapath-windows/ovsext/Driver.c | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/datapath-windows/ovsext/Driver.c b/datapath-windows/ovsext/Driver.c
> index 13fcde2..853886e 100644
> --- a/datapath-windows/ovsext/Driver.c
> +++ b/datapath-windows/ovsext/Driver.c
> @@ -139,18 +139,26 @@ DriverEntry(PDRIVER_OBJECT driverObject,
>      driverObject->DriverUnload = OvsExtUnload;
>  
>      status = NdisFRegisterFilterDriver(driverObject,
> -                                       (NDIS_HANDLE) gOvsExtDriverObject,
> -                                       &driverChars, &gOvsExtDriverHandle);
> +                                       (NDIS_HANDLE)gOvsExtDriverObject,
> +                                       &driverChars,
> +                                       &gOvsExtDriverHandle);
>      if (status != NDIS_STATUS_SUCCESS) {
> -        return status;
> +        goto cleanup;
>      }
>  
> -    /* Create the communication channel for usersapce. */
> +    /* Create the communication channel for userspace. */
>      status = OvsCreateDeviceObject(gOvsExtDriverHandle);
>      if (status != NDIS_STATUS_SUCCESS) {
> +        goto cleanup;
> +    }
> +
> +cleanup:
> +    if (status != NDIS_STATUS_SUCCESS){
>          OvsCleanup();
> -        NdisFDeregisterFilterDriver(gOvsExtDriverHandle);
> -        gOvsExtDriverHandle = NULL;
> +        if (gOvsExtDriverHandle) {
> +            NdisFDeregisterFilterDriver(gOvsExtDriverHandle);
> +            gOvsExtDriverHandle = NULL;
> +        }
>      }
>  
>      return status;
> -- 
> 1.9.0.msysgit.0
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list