]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - kernel/pid.c
bpf: Prevent re-mmap()'ing BPF map as writable for initially r/o mapping
[mirror_ubuntu-jammy-kernel.git] / kernel / pid.c
index 647b4bb457b5945d16f217ab7ad785cd2b2f84d1..bc21c0fb26d8b09e564aead32d8bb8b3d8a938d9 100644 (file)
@@ -144,9 +144,6 @@ void free_pid(struct pid *pid)
                        /* Handle a fork failure of the first process */
                        WARN_ON(ns->child_reaper);
                        ns->pid_allocated = 0;
-                       /* fall through */
-               case 0:
-                       schedule_work(&ns->proc_work);
                        break;
                }
 
@@ -257,17 +254,13 @@ struct pid *alloc_pid(struct pid_namespace *ns, pid_t *set_tid,
         */
        retval = -ENOMEM;
 
-       if (unlikely(is_child_reaper(pid))) {
-               if (pid_ns_prepare_proc(ns))
-                       goto out_free;
-       }
-
        get_pid_ns(ns);
        refcount_set(&pid->count, 1);
        for (type = 0; type < PIDTYPE_MAX; ++type)
                INIT_HLIST_HEAD(&pid->tasks[type]);
 
        init_waitqueue_head(&pid->wait_pidfd);
+       INIT_HLIST_HEAD(&pid->inodes);
 
        upid = pid->numbers + ns->level;
        spin_lock_irq(&pidmap_lock);
@@ -594,7 +587,7 @@ static struct file *__pidfd_fget(struct task_struct *task, int fd)
        struct file *file;
        int ret;
 
-       ret = mutex_lock_killable(&task->signal->cred_guard_mutex);
+       ret = mutex_lock_killable(&task->signal->exec_update_mutex);
        if (ret)
                return ERR_PTR(ret);
 
@@ -603,7 +596,7 @@ static struct file *__pidfd_fget(struct task_struct *task, int fd)
        else
                file = ERR_PTR(-EPERM);
 
-       mutex_unlock(&task->signal->cred_guard_mutex);
+       mutex_unlock(&task->signal->exec_update_mutex);
 
        return file ?: ERR_PTR(-EBADF);
 }