[PATCH 6.12 1257/1276] afs: Fix afs_atcell_get_link() to check if ws_cell is unset first
Greg Kroah-Hartman
gregkh at linuxfoundation.org
Tue Jul 21 08:28:20 PDT 2026
6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <dhowells at redhat.com>
commit 0307d16f3610eb29ad0b7529846de7d62fed60ca upstream.
Fix afs_atcell_get_link() to check if the workstation cell is unset before
doing the RCU pathwalk bit where we dereference that.
Fixes: 823869e1e616 ("afs: Fix afs_atcell_get_link() to handle RCU pathwalk")
Reported-by: syzbot+76a6f18e3af82e84f264 at syzkaller.appspotmail.com
Signed-off-by: David Howells <dhowells at redhat.com>
Link: https://lore.kernel.org/r/2481796.1742296819@warthog.procyon.org.uk
Tested-by: syzbot+76a6f18e3af82e84f264 at syzkaller.appspotmail.com
cc: Marc Dionne <marc.dionne at auristor.com>
cc: linux-afs at lists.infradead.org
cc: linux-fsdevel at vger.kernel.org
Signed-off-by: Christian Brauner <brauner at kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
fs/afs/dynroot.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/fs/afs/dynroot.c
+++ b/fs/afs/dynroot.c
@@ -209,6 +209,9 @@ static const char *afs_atcell_get_link(s
const char *name;
bool dotted = vnode->fid.vnode == 3;
+ if (!rcu_access_pointer(net->ws_cell))
+ return ERR_PTR(-ENOENT);
+
if (!dentry) {
/* We're in RCU-pathwalk. */
cell = rcu_dereference(net->ws_cell);
@@ -220,9 +223,6 @@ static const char *afs_atcell_get_link(s
return name;
}
- if (!rcu_access_pointer(net->ws_cell))
- return ERR_PTR(-ENOENT);
-
down_read(&net->cells_lock);
cell = rcu_dereference_protected(net->ws_cell, lockdep_is_held(&net->cells_lock));
More information about the linux-afs
mailing list