[PATCH v2] erofs-utils: lib: fix erofs_iterate_dir() recursion

Gao Xiang xiang at kernel.org
Sat Jul 22 16:20:25 AEST 2023


Hi Jingbo,

On Sat, Jul 22, 2023 at 01:40:09PM +0800, Jingbo Xu wrote:
> ctx->dir may have changed when ctx is reused along erofs_iterate_dir()
> recursion.
> 
> Signed-off-by: Jingbo Xu <jefflexu at linux.alibaba.com>
> ---
> changes since last version:
> since traverse_dirents() can be called multiple times in one single
> erofs_iterate_dir() call, ctx->dir may have changed at the entry of
> traverse_dirents().  The previous v1 shall be deprecated.
> 
> v1: https://lore.kernel.org/all/20230718052101.124039-3-jefflexu@linux.alibaba.com/

I plan to drop this commit directly.  `struct erofs_dir_context` is not
designed for reusing recursively. It's not the case just due to
`ctx->dir` but also internal states.

You need to build another ctx for recursion.

Thanks,
Gao Xiang


More information about the Linux-erofs mailing list