include/linux/cleanup.h | 7 +++---- kernel/ptrace.c | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/cleanup.h b/include/linux/cleanup.h index c2d09bc4f976..a015ac9517a6 100644 --- a/include/linux/cleanup.h +++ b/include/linux/cleanup.h @@ -142,7 +142,7 @@ static inline class_##_name##_t class_##_name##ext##_constructor(_init_args) \ * for conditional locks the loop body is skipped when the lock is not * acquired. * - * scoped_cond_guard (name, fail, args...) { }: + * scoped_cond_guard (name, args...) { } [ else { fail } : * similar to scoped_guard(), except it does fail when the lock * acquire fails. * @@ -169,11 +169,10 @@ static inline class_##_name##_t class_##_name##ext##_constructor(_init_args) \ for (CLASS(_name, scope)(args), \ *done = NULL; __guard_ptr(_name)(&scope) && !done; done = (void *)1) -#define scoped_cond_guard(_name, _fail, args...) \ +#define scoped_cond_guard(_name, args...) \ for (CLASS(_name, scope)(args), \ *done = NULL; !done; done = (void *)1) \ - if (!__guard_ptr(_name)(&scope)) _fail; \ - else + if (__guard_ptr(_name)(&scope)) /* * Additional helper macros for generating lock guards with types, either for diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 2fabd497d659..f509b21a5711 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -441,8 +441,7 @@ static int ptrace_attach(struct task_struct *task, long request, * SUID, SGID and LSM creds get determined differently * under ptrace. */ - scoped_cond_guard (mutex_intr, return -ERESTARTNOINTR, - &task->signal->cred_guard_mutex) { + scoped_cond_guard (mutex_intr, &task->signal->cred_guard_mutex) { scoped_guard (task_lock, task) { retval = __ptrace_may_access(task, PTRACE_MODE_ATTACH_REALCREDS); @@ -466,6 +465,8 @@ static int ptrace_attach(struct task_struct *task, long request, ptrace_set_stopped(task); } + } else { + return -ERESTARTNOINTR; } /*