]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - fs/exec.c
UBUNTU: Ubuntu-4.13.0-45.50
[mirror_ubuntu-artful-kernel.git] / fs / exec.c
index 5c2c1ff3bd9a4811dac6d89da67fcf258e4ad57d..0f47bb84860c3a79e7c4fe0f4425459b665cff13 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -62,6 +62,7 @@
 #include <linux/oom.h>
 #include <linux/compat.h>
 #include <linux/vmalloc.h>
+#include <linux/delay.h>
 
 #include <trace/events/fs.h>
 
@@ -1465,6 +1466,7 @@ static void check_unsafe_exec(struct linux_binprm *bprm)
        struct task_struct *p = current, *t;
        unsigned n_fs;
        bool fs_recheck;
+       int count = 0;
 
        if (p->ptrace)
                bprm->unsafe |= LSM_UNSAFE_PTRACE;
@@ -1492,8 +1494,11 @@ recheck:
 
        if (p->fs->users > n_fs) {
                if (fs_recheck) {
-                       spin_unlock(&p->fs->lock);
-                       goto recheck;
+                       if (count++ < 20) {
+                               spin_unlock(&p->fs->lock);
+                               msleep_interruptible(1);
+                               goto recheck;
+                       }
                }
                bprm->unsafe |= LSM_UNSAFE_SHARE;
        } else