Skip to content

Commit 4a1ddb0

Browse files
committed
pidfs: avoid misleading break
The break would only break out of the scoped_guard() loop, not the switch statement. It still works correct as is ofc but let's avoid the confusion. Reported-by: David Lechner <dlechner@baylibre.com> Link:: https://lore.kernel.org/cd2153f1-098b-463c-bbc1-5c6ca9ef1f12@baylibre.com Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent fdcfce9 commit 4a1ddb0

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

fs/pidfs.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -577,9 +577,8 @@ static long pidfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
577577
struct user_namespace *user_ns;
578578

579579
user_ns = task_cred_xxx(task, user_ns);
580-
if (!ns_ref_get(user_ns))
581-
break;
582-
ns_common = to_ns_common(user_ns);
580+
if (ns_ref_get(user_ns))
581+
ns_common = to_ns_common(user_ns);
583582
}
584583
#endif
585584
break;
@@ -589,9 +588,8 @@ static long pidfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
589588
struct pid_namespace *pid_ns;
590589

591590
pid_ns = task_active_pid_ns(task);
592-
if (!ns_ref_get(pid_ns))
593-
break;
594-
ns_common = to_ns_common(pid_ns);
591+
if (ns_ref_get(pid_ns))
592+
ns_common = to_ns_common(pid_ns);
595593
}
596594
#endif
597595
break;

0 commit comments

Comments
 (0)