public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: syzbot <syzbot+76a6f18e3af82e84f264@syzkaller.appspotmail.com>
Cc: dhowells@redhat.com, enjuk@amazon.com,
	linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org,
	marc.dionne@auristor.com, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [afs?] general protection fault in afs_atcell_get_link
Date: Tue, 18 Mar 2025 10:23:47 +0000	[thread overview]
Message-ID: <2477988.1742293427@warthog.procyon.org.uk> (raw)
In-Reply-To: <67d93d58.050a0220.2ca2c6.016a.GAE@google.com>

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

commit 3ce74c88a6708de1842dbebc10f83013718324d0
Author: David Howells <dhowells@redhat.com>
Date:   Tue Mar 18 10:18:29 2025 +0000

    afs: Fix afs_atcell_get_link() to check if ws_cell is unset first
    
    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>
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: linux-afs@lists.infradead.org
    cc: linux-fsdevel@vger.kernel.org

diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c
index 008698d706ca..7d997f7a8028 100644
--- a/fs/afs/dynroot.c
+++ b/fs/afs/dynroot.c
@@ -314,6 +314,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);
@@ -325,9 +328,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));


  reply	other threads:[~2025-03-18 10:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250318091024.45600-1-enjuk@amazon.com>
2025-03-18  9:31 ` [syzbot] [afs?] general protection fault in afs_atcell_get_link syzbot
2025-03-18 10:23   ` David Howells [this message]
2025-03-18 10:43     ` syzbot
2025-03-18 11:17     ` Edward Adam Davis
2025-03-18  8:10 syzbot
2025-03-18  9:17 ` Edward Adam Davis
2025-03-18  9:51   ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2477988.1742293427@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=enjuk@amazon.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.dionne@auristor.com \
    --cc=syzbot+76a6f18e3af82e84f264@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox