Re: [syzbot] [fs?] WARNING: lock held when returning to user space in ns_ioctl

From: Hillf Danton
Date: Thu Jul 18 2024 - 07:06:12 EST


On Wed, 17 Jul 2024 18:31:24 -0700
> syzbot found the following issue on:
>
> HEAD commit: 51835949dda3 Merge tag 'net-next-6.11' of git://git.kernel..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15ef5b4e980000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 51835949dda3

--- x/fs/nsfs.c
+++ y/fs/nsfs.c
@@ -188,8 +188,10 @@ static long ns_ioctl(struct file *filp,
tsk = find_task_by_vpid(arg);
else
tsk = find_task_by_pid_ns(arg, pid_ns);
- if (!tsk)
+ if (!tsk) {
+ rcu_read_unlock();
break;
+ }

switch (ioctl) {
case NS_GET_PID_FROM_PIDNS:
--