mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] afs: Fix afs_atcell_get_link() to check if ws_cell is unset first
@ 2025-03-18 11:20 David Howells
  2025-03-18 11:33 ` Edward Adam Davis
  2025-03-19  8:23 ` Christian Brauner
  0 siblings, 2 replies; 3+ messages in thread
From: David Howells @ 2025-03-18 11:20 UTC (permalink / raw)
  To: Christian Brauner
  Cc: dhowells, Marc Dionne, syzbot+76a6f18e3af82e84f264, linux-afs,
	linux-fsdevel, linux-kernel

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@syzkaller.appspotmail.com
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: syzbot+76a6f18e3af82e84f264@syzkaller.appspotmail.com
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
cc: linux-fsdevel@vger.kernel.org
---
 fs/afs/dynroot.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c
index 9732a1e17db3..691e0ae607a1 100644
--- a/fs/afs/dynroot.c
+++ b/fs/afs/dynroot.c
@@ -210,6 +210,9 @@ static const char *afs_atcell_get_link(struct dentry *dentry, struct inode *inod
 	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);
@@ -221,9 +224,6 @@ static const char *afs_atcell_get_link(struct dentry *dentry, struct inode *inod
 		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));


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] afs: Fix afs_atcell_get_link() to check if ws_cell is unset first
  2025-03-18 11:20 [PATCH] afs: Fix afs_atcell_get_link() to check if ws_cell is unset first David Howells
@ 2025-03-18 11:33 ` Edward Adam Davis
  2025-03-19  8:23 ` Christian Brauner
  1 sibling, 0 replies; 3+ messages in thread
From: Edward Adam Davis @ 2025-03-18 11:33 UTC (permalink / raw)
  To: dhowells
  Cc: brauner, linux-afs, linux-fsdevel, linux-kernel, marc.dionne,
	syzbot+76a6f18e3af82e84f264

On Tue, 18 Mar 2025 11:20:19 +0000, David Howells wrote:
> 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@syzkaller.appspotmail.com
> Signed-off-by: David Howells <dhowells@redhat.com>
> Tested-by: syzbot+76a6f18e3af82e84f264@syzkaller.appspotmail.com
> cc: Marc Dionne <marc.dionne@auristor.com>
> cc: linux-afs@lists.infradead.org
> cc: linux-fsdevel@vger.kernel.org
My fix already sent, it is much earlier than your patch.
https://lore.kernel.org/all/tencent_8CA5671E3C533638973237484A0874917609@qq.com/

BR,
Edward


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] afs: Fix afs_atcell_get_link() to check if ws_cell is unset first
  2025-03-18 11:20 [PATCH] afs: Fix afs_atcell_get_link() to check if ws_cell is unset first David Howells
  2025-03-18 11:33 ` Edward Adam Davis
@ 2025-03-19  8:23 ` Christian Brauner
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2025-03-19  8:23 UTC (permalink / raw)
  To: David Howells
  Cc: Christian Brauner, Marc Dionne, syzbot+76a6f18e3af82e84f264,
	linux-afs, linux-fsdevel, linux-kernel

On Tue, 18 Mar 2025 11:20:19 +0000, David Howells wrote:
> Fix afs_atcell_get_link() to check if the workstation cell is unset before
> doing the RCU pathwalk bit where we dereference that.
> 
> 

Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes

[1/1] afs: Fix afs_atcell_get_link() to check if ws_cell is unset first
      https://git.kernel.org/vfs/vfs/c/0307d16f3610

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-19  8:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-18 11:20 [PATCH] afs: Fix afs_atcell_get_link() to check if ws_cell is unset first David Howells
2025-03-18 11:33 ` Edward Adam Davis
2025-03-19  8:23 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®