fs/nsfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Ensure that rcu read lock is given up before returning.
Reported-by: syzbot+a3e82ae343b26b4d2335@syzkaller.appspotmail.com
Fixes: ca567df74a28 ("nsfs: add pid translation ioctls")
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
I have a few fixes pending I plan to send out asap.
---
fs/nsfs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/nsfs.c b/fs/nsfs.c
index a4a925dce331..97c37a9631e5 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -174,14 +174,14 @@ static long ns_ioctl(struct file *filp, unsigned int ioctl,
fallthrough;
case NS_GET_PID_IN_PIDNS:
fallthrough;
- case NS_GET_TGID_IN_PIDNS:
+ case NS_GET_TGID_IN_PIDNS: {
if (ns->ops->type != CLONE_NEWPID)
return -EINVAL;
ret = -ESRCH;
pid_ns = container_of(ns, struct pid_namespace, ns);
- rcu_read_lock();
+ guard(rcu)();
if (ioctl == NS_GET_PID_IN_PIDNS ||
ioctl == NS_GET_TGID_IN_PIDNS)
@@ -208,11 +208,11 @@ static long ns_ioctl(struct file *filp, unsigned int ioctl,
ret = 0;
break;
}
- rcu_read_unlock();
if (!ret)
ret = -ESRCH;
break;
+ }
default:
ret = -ENOTTY;
}
--
2.43.0
On Tue, 16 Jul 2024 09:19:11 +0200, Christian Brauner wrote:
> Ensure that rcu read lock is given up before returning.
>
>
Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes
[1/1] nsfs: use cleanup guard
https://git.kernel.org/vfs/vfs/c/0052b241e3e5
© 2016 - 2025 Red Hat, Inc.