After failing to parse parameters in ovl_parse_param_lowerdir(), it is necessary to update ctx->nr with the correct nr before using ovl_reset_lowerdirs() to release l->name. Reported-and-tested-by: syzbot+26eedf3631650972f17c@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Edward Adam Davis <eadavis@xxxxxx> --- fs/overlayfs/params.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/overlayfs/params.c b/fs/overlayfs/params.c index ddab9ea267d1..1f73f0173015 100644 --- a/fs/overlayfs/params.c +++ b/fs/overlayfs/params.c @@ -530,6 +530,7 @@ static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc) return 0; out_put: + ctx->nr = nr; ovl_reset_lowerdirs(ctx); out_err: -- 2.25.1