diff options
author | Shashank Ram <rams@vmware.com> | 2017-09-22 14:24:51 -0700 |
---|---|---|
committer | Gurucharan Shetty <guru@ovn.org> | 2017-09-28 02:07:32 -0700 |
commit | 880b52e6f6cc111f7ad09059bedde9da572782ab (patch) | |
tree | 6344990d914cc86a244562e902b9702c462e394c /datapath-windows/ovsext/Stt.c | |
parent | 4bf770c3053dfdbac8e9cf21820948106bf5b3fb (diff) | |
download | openvswitch-880b52e6f6cc111f7ad09059bedde9da572782ab.tar.gz |
datapath-windows: Fix bugs in cleaner threads
Conntrack, Conntrack-related, Stt, and IP fragmentation
have cleaner threads that run periodically to clean
up their respective tables. During driver unload,
OvsExtDetach() calls into routines that are meant
for explicitly cleaning these tables up and freeing
the resources associated with these threads.
If during driver unload, these cleaner threads run
immediately after the resources are freed, such as locks
used by these threads, then the cleaner threads result
in a kernel crash since they try to acquire locks
that have already been freed.
For eg, OvsIpFragmentEntryCleaner() caused a kernel
crash because it tried to acquire a lock that was
already freed by OvsCleanupIpFragment().
The fix is to simply exit the cleaner thread if the
lock associated with the thread is not initialized,
because the only way the threads can run when the lock
is invalid is when the lock has been freed up during
driver unload.
Testing done:
Verified that cleaner threads run as expected without
crashing during driver unload.
Signed-off-by: Shashank Ram <rams@vmware.com>
Acked-by: Anand Kumar <kumaranand@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
Diffstat (limited to 'datapath-windows/ovsext/Stt.c')
-rw-r--r-- | datapath-windows/ovsext/Stt.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/datapath-windows/ovsext/Stt.c b/datapath-windows/ovsext/Stt.c index b6236fd7f..f98070f33 100644 --- a/datapath-windows/ovsext/Stt.c +++ b/datapath-windows/ovsext/Stt.c @@ -551,6 +551,10 @@ OvsSttDefragCleaner(PVOID data) BOOLEAN success = TRUE; while (success) { + if (&OvsSttSpinLock == NULL) { + /* Lock has been freed by 'OvsCleanupSttDefragmentation()' */ + break; + } NdisAcquireSpinLock(&OvsSttSpinLock); if (context->exit) { NdisReleaseSpinLock(&OvsSttSpinLock); |