Merge branches 'cond_resched.2017.12.04a', 'dyntick.2017.11.28a', 'fixes.2017.12...
[linux-2.6-microblaze.git] / kernel / umh.c
index 6ff9905..18e5fa4 100644 (file)
@@ -537,14 +537,14 @@ static int proc_cap_handler(struct ctl_table *table, int write,
        /*
         * Drop everything not in the new_cap (but don't add things)
         */
-       spin_lock(&umh_sysctl_lock);
        if (write) {
+               spin_lock(&umh_sysctl_lock);
                if (table->data == CAP_BSET)
                        usermodehelper_bset = cap_intersect(usermodehelper_bset, new_cap);
                if (table->data == CAP_PI)
                        usermodehelper_inheritable = cap_intersect(usermodehelper_inheritable, new_cap);
+               spin_unlock(&umh_sysctl_lock);
        }
-       spin_unlock(&umh_sysctl_lock);
 
        return 0;
 }