6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Darrick J. Wong commit 4582327e7068194d55941b49dd66be211b9e3f90 upstream. LOLLM observed that if the live update hooks for the directory tree repair code ever fail, they'll set dl->aborted, but then the main repair code path won't check it to exit early. This can cause incorrect repairs, so let's check for hook errors and abort the repair. Cc: stable@vger.kernel.org # v6.10 Fixes: 3f31406aef493b ("xfs: fix corruptions in the directory tree") Signed-off-by: Darrick J. Wong Assisted-by: LOLLM # finding obvious bugs Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino Signed-off-by: Greg Kroah-Hartman --- fs/xfs/scrub/dirtree_repair.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/fs/xfs/scrub/dirtree_repair.c +++ b/fs/xfs/scrub/dirtree_repair.c @@ -575,6 +575,8 @@ xrep_dirtree_delete_path( if (!error && dl->stale) error = -ESTALE; + if (!error && dl->aborted) + error = -EIO; return error; } @@ -720,6 +722,11 @@ xrep_dirtree_adopt( error = -ESTALE; goto out_trans; } + if (dl->aborted) { + mutex_unlock(&dl->lock); + error = -EIO; + goto out_trans; + } error = xrep_dirtree_create_adoption_path(dl); mutex_unlock(&dl->lock); if (error) @@ -780,6 +787,8 @@ xrep_dirtree_move_to_orphanage( if (!error && dl->stale) error = -ESTALE; + if (!error && dl->aborted) + error = -EIO; return error; }