Merge tag 'v5.0-rc3' into next-general
[sfrench/cifs-2.6.git] / security / yama / yama_lsm.c
index eb1da1303d2ef170ff446a24a9ade57bdff8efb9..57cc60722dd3855021c56a3e46d900e1f0ad0efe 100644 (file)
@@ -368,7 +368,9 @@ static int yama_ptrace_access_check(struct task_struct *child,
                        break;
                case YAMA_SCOPE_RELATIONAL:
                        rcu_read_lock();
-                       if (!task_is_descendant(current, child) &&
+                       if (!pid_alive(child))
+                               rc = -EPERM;
+                       if (!rc && !task_is_descendant(current, child) &&
                            !ptracer_exception_found(current, child) &&
                            !ns_capable(__task_cred(child)->user_ns, CAP_SYS_PTRACE))
                                rc = -EPERM;