[ovs-dev] [PATCH v6] datapath-windows: Avoid BSOD when switch context is NULL
Gurucharan Shetty
shettyg at nicira.com
Thu Nov 20 15:19:22 UTC 2014
On Tue, Nov 18, 2014 at 11:16 PM, Sorin Vinturis
<svinturis at cloudbasesolutions.com> wrote:
> I came around a BSOD that happened when trying to access pidHashLock
> from the gOvsSwitchContext, which was NULL. The stop happened in
> OvsAcquirePidHashLock function.
>
> To reproduce this BSOD, make sure the extension is enabled and running,
> disable it and, after that, execute 'ovs-dpctl.exe show'. The BSOD is
> triggered afterwards.
>
> Signed-off-by: Sorin Vinturis <svinturis at cloudbasesolutions.com>
> Reported-by: Sorin Vinturis <svinturis at cloudbasesolutions.com>
> Reported-at: https://github.com/openvswitch/ovs-issues/issues/53
> Acked-by: Eitan Eliahu <eliahue at vmware.com>
> Acked-by: Nithin Raju <nithin at vmware.com>
Applied, thanks!
> ---
> datapath-windows/ovsext/Tunnel.c | 3 ++-
> datapath-windows/ovsext/User.c | 13 +++++++++----
> 2 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/datapath-windows/ovsext/Tunnel.c b/datapath-windows/ovsext/Tunnel.c
> index b55a223..fed58f1 100644
> --- a/datapath-windows/ovsext/Tunnel.c
> +++ b/datapath-windows/ovsext/Tunnel.c
> @@ -224,9 +224,10 @@ OvsInjectPacketThroughActions(PNET_BUFFER_LIST pNbl,
> OvsCompletionList completionList;
> KIRQL irql;
> ULONG SendFlags = NDIS_SEND_FLAGS_SWITCH_DESTINATION_GROUP;
> - OVS_DATAPATH *datapath = &gOvsSwitchContext->datapath;
> + OVS_DATAPATH *datapath = NULL;
>
> ASSERT(gOvsSwitchContext);
> + datapath = &gOvsSwitchContext->datapath;
>
> /* Fill the tunnel key */
> status = OvsSlowPathDecapVxlan(pNbl, &tunnelKey);
> diff --git a/datapath-windows/ovsext/User.c b/datapath-windows/ovsext/User.c
> index fc27f7d..b67c78d 100644
> --- a/datapath-windows/ovsext/User.c
> +++ b/datapath-windows/ovsext/User.c
> @@ -141,10 +141,15 @@ OvsCleanupPacketQueue(POVS_OPEN_INSTANCE instance)
> OvsFreeMemory(queue);
> }
>
> - /* Remove the instance from pidHashArray */
> - OvsAcquirePidHashLock();
> - OvsDelPidInstance(gOvsSwitchContext, instance->pid);
> - OvsReleasePidHashLock();
> + /* Verify if gOvsSwitchContext exists. */
> + OvsAcquireCtrlLock();
> + if (gOvsSwitchContext) {
> + /* Remove the instance from pidHashArray */
> + OvsAcquirePidHashLock();
> + OvsDelPidInstance(gOvsSwitchContext, instance->pid);
> + OvsReleasePidHashLock();
> + }
> + OvsReleaseCtrlLock();
> }
>
> NTSTATUS
> --
> 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