FAILED: patch "[PATCH] xfs: Fix error pointer dereference" failed to apply to 6.12-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x cddfa648f1ab99e30e91455be19cd5ade26338c2
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026030917-lagged-volumes-b38a@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From cddfa648f1ab99e30e91455be19cd5ade26338c2 Mon Sep 17 00:00:00 2001
From: Ethan Tidmore <[email protected]>
Date: Thu, 19 Feb 2026 21:38:25 -0600
Subject: [PATCH] xfs: Fix error pointer dereference
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()
fs/xfs/scrub/orphanage.c +6 -1
@@ -442,6 +442,11 @@ xrep_adoption_check_dcache(return 0 ; d_child =try_lookup_noperm (&qname, d_orphanage); +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);
@@ -479,7 +484,7 @@ xrep_adoption_zap_dcache(return ; d_child =try_lookup_noperm (&qname, d_orphanage); -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));
Sasha Levin
maintainerPATCH 1/1 xfs: Fix error pointer dereference
From: Ethan Tidmore <[email protected]>
[ 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()
--- fs/xfs/scrub/orphanage.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/xfs/scrub/orphanage.c +6 -1
@@ -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));
Signature · 1 line
2.51.0
Re: [PATCH 6.12.y] xfs: Fix error pointer dereference
Quoted 17 lines · Sasha Levin
From: Ethan Tidmore <[email protected]>
[ 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()andxrep_adoption_zap_dcache().Detected by Smatch:
fs/xfs/scrub/orphanage.c:449xrep_adoption_check_dcache()error:
'd_child' dereferencing possibleERR_PTR()
fs/xfs/scrub/orphanage.c:485xrep_adoption_zap_dcache()error:
'd_child' dereferencing possibleERR_PTR()
Quoted 8 lines
Fixes 73597e3e42b4 ("xfs: ensure dentry consistency when the orphanage adopts a file")Cc [email protected] # v6.16Signed-off-by Ethan Tidmore <[email protected]>Reviewed-by Darrick J. Wong <[email protected]>Reviewed-by Nirjhar Roy (IBM) <[email protected]>Signed-off-by Carlos Maiolino <[email protected]>[ adapted try_lookup_noperm() calls to d_hash_and_lookup() ]Signed-off-by Sasha Levin <[email protected]>
Backport looks good to me,
--D
Quoted 32 lines
--- fs/xfs/scrub/orphanage.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)fs/xfs/scrub/orphanage.c +6
-1@@ -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));Signature · 1 line
2.51.0