Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.137.202.133 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796374653; b=pfUDSwDAb6JtUxYNJSUo3k6poN7ax3LdLkoSswiAzuZSmNpGn7+RmuCgVb6X/EpZ9KPe TrEwCps8HBJnNpv2fblwPS+Nk9bRDXv9+JDzhWqfP12rN9stlG+ze+rXp0BQwUWicCkTH j+1+IumTho3b2q2kuVXXS+QEdxeUDoxATXcPnWLRynAT8Y8Jg5HDw7zOBYqmzXK3wgLW7 v/Z1sNqSazu4WHH5LGEv1HNl6S1BQ7IqJQB3x0FoJ0VPKbwtO3WF9GQmN1SFsXavNmGJk 12pd1OeABcUjOddjJPfzDpXqaFthOrmjgoNn/cByxVuPwwiYEkRsNxkGP53ltgfEVdA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796374653; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To:X-SRS-Rewrite; bh=e8KtORSu9bSh8a060Gau4AVTVBB9EfqnVoi/jMY8v0E=; b=FYbWOcQ4zFXYyYXwGjSxfl7z0zw28uY8icxYnY8CXColfPs5JzEU09A5wHTnYlELIjnc QheoQ6RarLgpKELGPeROOiRMoYgi6mkzGpoR1Vbau8JQRFmxDQHwZkZdNhplN8LkCWjgp OlA26CZmbsYKcqZE6qmNDj59rHmvnsYWW5YG30Z53MGdMJP/0U/UxHIuuqPgGlBbJniiL Zp8cVWRDhU2bx6eqG6UTAq6PXulzrSU+J6OwQJgoYG/ziTmwvELiu441IQgdRVgiAz7Nm CE9AHMl+ph5uEfu8A57wdQFWOiw1b5z08ppU4j0NW6eklGsuyRCBL347MwXtrE1Iz+g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=infradead.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=qWU1KaQQ; arc=none smtp.remote-ip=198.137.202.133 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3846E606A322; Fri, 4 Dec 2026 08:57:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3846E606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=qWU1KaQQ DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=e8KtORSu9bSh8a060Gau4AVTVBB9EfqnVoi/jMY8v0E=; b=qWU1KaQQ2XpqmzTppBWawkTEqt X6EBF8ca9frFR8av3qna1DRa8w10H8ePGIhfvhYYqUZe8YipWyt8bYR+HlJ+ZQleARnHFngnIPVpY oxyJzERpgn7Wb4r2J66PMW512t0eoATnjByRyB3tEplVChvV4xHikxhnZ0nPK9WWyG0NyQthPO2fO kZIYdM4KldKmoIoeWx9A+6DNrClSMejZv+iBdjtkx+8LGstuAPQ9wMgyftvy3Q3ZUoLpM9X+uRj9v qhdCGMZmz8CDF8gnBY2rsGRYvTDn2p0dMrO6mu9DQDLubDKBuWTKcJy3orczrchGVG1ufMICdfKO2 RIXMsApg==; Received: from hch by bombadil.infradead.org with local (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZP6i-0000000HF6R-1Xz9; Fri, 04 Dec 2026 08:57:32 +0000 Date: Fri, 4 Dec 2026 00:57:32 -0800 From: Christoph Hellwig To: Zheng Shuhao Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, hch@infradead.org, cem@kernel.org, djwong@kernel.org, hemanth.selam@gmail.com, shinsj4653@gmail.com, syzbot+e7f24354da9f7915bc54@syzkaller.appspotmail.com Subject: Re: [PATCH v3] xfs: fix slab-use-after-free in xrep_newbt_free() Message-ID: References: <179630412330.565.9260762935217160800@gmail.com> X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <179630412330.565.9260762935217160800@gmail.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html The email format is a bit odd. It obviously is a reply continuing the previous discussion, but it breaks threading and adds a new subject. On Thu, Dec 03, 2026 at 09:22:03PM +0800, Zheng Shuhao wrote: > On Wed, Dec 2, 2026 at 07:28:34AM +0000, Christoph Hellwig wrote: > > Using the control flow instead of global state is usually preferable. > > I.e. check which path can free the autoreap information and treat them > > differently using a goto or similar. I think the only relevant call is > > xrep_newbt_free in the xrep_newbt_free loop, but I'm not an expert on > > this code, so please double check. > > I considered changing the control flow, but found that this would make > error-path handling more complex because the defer-finish failure paths > would need to be handled separately. > > I therefore kept the existing control flow and used a standard list > traversal to check whether the exact deferred item is still pending > before unpausing it. This now pokes into defer_ops implementation details. I spent some time looking at this, but AFAICS the call to xfs_alloc_commit_autoreap in xrep_newbt_free is always superfluous. The only way we can end up in that error path is with a file system either already shut down, or about to shut down due to corruption. So xfs_alloc_commit_autoreap won't have any effect and we can just remove it entirely.