Author: kib
Date: Mon Jan 20 08:55:27 2020
New Revision: 356906
URL: https://svnweb.freebsd.org/changeset/base/356906

Log:
  MFC r356682:
  Code must not unlock a mutex while owning the thread lock.

Modified:
  stable/12/sys/compat/linuxkpi/common/src/linux_rcu.c
  stable/12/sys/kern/subr_epoch.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linuxkpi/common/src/linux_rcu.c
==============================================================================
--- stable/12/sys/compat/linuxkpi/common/src/linux_rcu.c        Mon Jan 20 
08:28:54 2020        (r356905)
+++ stable/12/sys/compat/linuxkpi/common/src/linux_rcu.c        Mon Jan 20 
08:55:27 2020        (r356906)
@@ -297,14 +297,13 @@ linux_synchronize_rcu(void)
            "linux_synchronize_rcu() can sleep");
 
        td = curthread;
+       DROP_GIANT();
 
        /*
         * Synchronizing RCU might change the CPU core this function
         * is running on. Save current values:
         */
        thread_lock(td);
-
-       DROP_GIANT();
 
        old_cpu = PCPU_GET(cpuid);
        old_pinned = td->td_pinned;

Modified: stable/12/sys/kern/subr_epoch.c
==============================================================================
--- stable/12/sys/kern/subr_epoch.c     Mon Jan 20 08:28:54 2020        
(r356905)
+++ stable/12/sys/kern/subr_epoch.c     Mon Jan 20 08:55:27 2020        
(r356906)
@@ -499,8 +499,8 @@ epoch_wait_preempt(epoch_t epoch)
        KASSERT(!in_epoch(epoch), ("epoch_wait_preempt() called in the middle "
            "of an epoch section of the same epoch"));
 #endif
-       thread_lock(td);
        DROP_GIANT();
+       thread_lock(td);
 
        old_cpu = PCPU_GET(cpuid);
        old_pinned = td->td_pinned;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to