diff options
| author | Christian Brauner <brauner@kernel.org> | 2026-02-24 12:09:00 +0100 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-02-24 12:09:00 +0100 |
| commit | 4a1ddb0f1c48c2b56f21d8b5200e2e29adf4c1df (patch) | |
| tree | a5e2f50ae04dae17058b57a0695433d1e878ec75 | |
| parent | fdcfce93073d990ed4b71752e31ad1c1d6e9d58b (diff) | |
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>
| -rw-r--r-- | fs/pidfs.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/pidfs.c b/fs/pidfs.c index 1e20e36e0ed5..21f9f011a957 100644 --- a/fs/pidfs.c +++ b/fs/pidfs.c @@ -577,9 +577,8 @@ static long pidfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) struct user_namespace *user_ns; user_ns = task_cred_xxx(task, user_ns); - if (!ns_ref_get(user_ns)) - break; - ns_common = to_ns_common(user_ns); + if (ns_ref_get(user_ns)) + ns_common = to_ns_common(user_ns); } #endif break; @@ -589,9 +588,8 @@ static long pidfd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) struct pid_namespace *pid_ns; pid_ns = task_active_pid_ns(task); - if (!ns_ref_get(pid_ns)) - break; - ns_common = to_ns_common(pid_ns); + if (ns_ref_get(pid_ns)) + ns_common = to_ns_common(pid_ns); } #endif break; |
