Re: [PATCH v2] xfs: fix slab-use-after-free in xrep_newbt_free()

From: Christoph Hellwig

Date: Tue Dec 01 2026 - 03:58:57 EST


On Sun, Nov 29, 2026 at 06:53:38PM +0800, Zheng Shuhao wrote:
> list_for_each_entry_safe(resv, n, &xnr->resv_list, list) {
> - xfs_alloc_commit_autoreap(sc->tp, &resv->autoreap);
> + if (!xfs_is_shutdown(sc->mp))
> + xfs_alloc_commit_autoreap(sc->tp, &resv->autoreap);

I don't think this is the correct check, and the commit log does not
describe the situation correctly.

A shutdown does not free deferred items. A failing
xfs_defer_finish_noroll just happens to call xfs_defer_cancel_list
AND shuts down the file systems. So the condition here is not
"is the file system shut down" but: did a defer_finish fail for this
chain, and the logic needs to represent that.