[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <85069.1743183981@warthog.procyon.org.uk>
Date: Fri, 28 Mar 2025 17:46:21 +0000
From: David Howells <dhowells@...hat.com>
To: syzbot <syzbot+54e6c2176ba76c56217e@...kaller.appspotmail.com>
Cc: dhowells@...hat.com, almaz.alexandrovich@...agon-software.com,
linux-afs@...ts.infradead.org, linux-kernel@...r.kernel.org,
marc.dionne@...istor.com, ntfs3@...ts.linux.dev,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [afs?] [ntfs3?] BUG: sleeping function called from invalid context in ovl_cache_entry_new
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
commit f34068283e8650ecd7a2f57b0b55aa91e498a470
Author: David Howells <dhowells@...hat.com>
Date: Fri Mar 28 16:46:58 2025 +0000
afs: Fix afs_dynroot_readdir() to not use the RCU read lock
afs_dynroot_readdir() uses the RCU read lock to walk the cell list whilst
emitting cell automount entries - but dir_emit() may write to a userspace
buffer, thereby causing a fault to occur and waits to happen.
Fix afs_dynroot_readdir() to get a shared lock on i_rwsem instead.
Fixes: 1d0b929fc070 ("afs: Change dynroot to create contents on demand")
Reported-by: syzbot+3b6c5c6a1d0119b687a1@...kaller.appspotmail.com
Signed-off-by: David Howells <dhowells@...hat.com>
cc: Marc Dionne <marc.dionne@...istor.com>
cc: linux-afs@...ts.infradead.org
cc: linux-fsdevel@...r.kernel.org
diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c
index 691e0ae607a1..61bc8c81c5ca 100644
--- a/fs/afs/dynroot.c
+++ b/fs/afs/dynroot.c
@@ -348,9 +348,9 @@ static int afs_dynroot_readdir(struct file *file, struct dir_context *ctx)
}
if ((unsigned long long)ctx->pos <= AFS_MAX_DYNROOT_CELL_INO) {
- rcu_read_lock();
+ down_read(&file_inode(file)->i_rwsem);
ret = afs_dynroot_readdir_cells(net, ctx);
- rcu_read_unlock();
+ up_read(&file_inode(file)->i_rwsem);
}
return ret;
}
Powered by blists - more mailing lists