From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF5A131AAAA for ; Tue, 10 Mar 2026 21:06:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773176764; cv=none; b=X0LTEab+0ugcsy4nWVkDW5kCLq1Sl1K3U0/1o0uaAzy8LP03FN8KMGFFN6SfbPS1YgTygW0x3oDgiwgLuFaVo/TWN+Acv2zkdqsog2eucvSQ58GJDTTXHoeJMGdx6raNDQY7ioH5tuN1geEsuk/v380/kqFzJsAmv/crP3Czszg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773176764; c=relaxed/simple; bh=JIrgtQkSf8zhty1TZ8k8oXWYwByV+1eg+nmYxdIfThU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gftZyR3iWRT1sx4cGFsmBY9NVVfjtTUgDVdOmJpT/1sKfLdId/dAQI6NM0EosXCS30kFyOPsAQfntMFMjZLvU7PO6YeHeVnL/MX+1wcAAO7QKCKD8h3pZj9ZDi2d5jIGq2eYkmiseLifnQt7+1JZiaOhpryn+VkUHFz0olOTpws= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MDMaOSBU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MDMaOSBU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97851C19423; Tue, 10 Mar 2026 21:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773176763; bh=JIrgtQkSf8zhty1TZ8k8oXWYwByV+1eg+nmYxdIfThU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MDMaOSBUnWjpblfF8GxbQEsL0ITMNsbs43VM0WG41TNsB9p4qp/F0SQgPidNNZ8cV tVq+5ZaF2oOx0lx6EG9e+yAACasOIaf5jJGcKkEuz0Y1yYeRwD1I7f3tRpt+Q6mXoi Bixd2tCI+DYE08FLO/LQ4vxCtMe8EvD+apWAM8s5TV50FonYIwwCeVuUG9qMoJ1xjF L9ULi+US/xfvu2ny+H9cmr9CrIbcoJYWaBq/hemhTzIxAKOwoTMshZAQ+nL9f6JLJ1 SirKgbM13IwNW4uAbXz7Emcb8FwNwvYjSNCIZe4bBmSJG+v5t3Wj23BjKqsYiys/R/ +UcCSVgPzDmpQ== Date: Tue, 10 Mar 2026 14:06:03 -0700 From: "Darrick J. Wong" To: Sasha Levin Cc: stable@vger.kernel.org, Ethan Tidmore , "Nirjhar Roy (IBM)" , Carlos Maiolino Subject: Re: [PATCH 6.12.y] xfs: Fix error pointer dereference Message-ID: <20260310210603.GA6023@frogsfrogsfrogs> References: <2026030917-lagged-volumes-b38a@gregkh> <20260309134955.1022573-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260309134955.1022573-1-sashal@kernel.org> On Mon, Mar 09, 2026 at 09:49:55AM -0400, Sasha Levin wrote: > From: Ethan Tidmore > > [ Upstream commit cddfa648f1ab99e30e91455be19cd5ade26338c2 ] > > The function try_lookup_noperm() can return an error pointer and is not > checked for one. > > Add checks for error pointer in xrep_adoption_check_dcache() and > xrep_adoption_zap_dcache(). > > Detected by Smatch: > fs/xfs/scrub/orphanage.c:449 xrep_adoption_check_dcache() error: > 'd_child' dereferencing possible ERR_PTR() > > fs/xfs/scrub/orphanage.c:485 xrep_adoption_zap_dcache() error: > 'd_child' dereferencing possible ERR_PTR() > > Fixes: 73597e3e42b4 ("xfs: ensure dentry consistency when the orphanage adopts a file") > Cc: stable@vger.kernel.org # v6.16 > Signed-off-by: Ethan Tidmore > Reviewed-by: Darrick J. Wong > Reviewed-by: Nirjhar Roy (IBM) > Signed-off-by: Carlos Maiolino > [ adapted try_lookup_noperm() calls to d_hash_and_lookup() ] > Signed-off-by: Sasha Levin Backport looks good to me, Acked-by: "Darrick J. Wong" --D > --- > fs/xfs/scrub/orphanage.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/fs/xfs/scrub/orphanage.c b/fs/xfs/scrub/orphanage.c > index 7148d8362db83..46171f61eda43 100644 > --- a/fs/xfs/scrub/orphanage.c > +++ b/fs/xfs/scrub/orphanage.c > @@ -443,6 +443,11 @@ xrep_adoption_check_dcache( > return 0; > > d_child = d_hash_and_lookup(d_orphanage, &qname); > + if (IS_ERR(d_child)) { > + dput(d_orphanage); > + return PTR_ERR(d_child); > + } > + > if (d_child) { > trace_xrep_adoption_check_child(sc->mp, d_child); > > @@ -480,7 +485,7 @@ xrep_adoption_zap_dcache( > return; > > d_child = d_hash_and_lookup(d_orphanage, &qname); > - while (d_child != NULL) { > + while (!IS_ERR_OR_NULL(d_child)) { > trace_xrep_adoption_invalidate_child(sc->mp, d_child); > > ASSERT(d_is_negative(d_child)); > -- > 2.51.0 >