Re: [PATCH] afs: Fix afs_dynroot_readdir() to not use the RCU read lock

From: Christian Brauner
Date: Wed Apr 09 2025 - 06:13:43 EST


On Tue, 08 Apr 2025 21:46:29 +0100, David Howells wrote:
> 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 net->cells_lock instead.
>
> This can be triggered by enabling lockdep, preconfiguring a number of
> cells, doing "mount -t afs none /afs -o dyn" (or using the kafs-client
> package with afs.mount systemd unit enabled) and then doing "ls /afs".
>
> [...]

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] afs: Fix afs_dynroot_readdir() to not use the RCU read lock
https://git.kernel.org/vfs/vfs/c/7571ebd29ff2