All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: syzbot <syzbot+54e6c2176ba76c56217e@syzkaller.appspotmail.com>
Cc: dhowells@redhat.com, almaz.alexandrovich@paragon-software.com,
	linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org,
	marc.dionne@auristor.com, ntfs3@lists.linux.dev,
	syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [afs?] [ntfs3?] BUG: sleeping function called from invalid context in ovl_cache_entry_new
Date: Mon, 31 Mar 2025 09:06:10 +0100	[thread overview]
Message-ID: <164841.1743408370@warthog.procyon.org.uk> (raw)
In-Reply-To: <67e57c6c.050a0220.2f068f.0036.GAE@google.com>

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

commit db7a516159869b19f237c73bd75599bbe0bfcc4d
Author: David Howells <dhowells@redhat.com>
Date:   Fri Mar 28 16:46:58 2025 +0000

    afs: Fix afs_dynroot_readdir() to not use the RCU read lock
    
    afs_dynroot_readdir() uses the RCU read lock to walk the cell list whilst
    emitting cell automount entries - but dir_emit() may write to a userspace
    buffer, thereby causing a fault to occur and waits to happen.
    
    Fix afs_dynroot_readdir() to get a shared lock on net->cells_lock instead.
    
    Fixes: 1d0b929fc070 ("afs: Change dynroot to create contents on demand")
    Reported-by: syzbot+3b6c5c6a1d0119b687a1@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 691e0ae607a1..8c6130789fde 100644
--- a/fs/afs/dynroot.c
+++ b/fs/afs/dynroot.c
@@ -348,9 +348,9 @@ static int afs_dynroot_readdir(struct file *file, struct dir_context *ctx)
 	}
 
 	if ((unsigned long long)ctx->pos <= AFS_MAX_DYNROOT_CELL_INO) {
-		rcu_read_lock();
+		down_read(&net->cells_lock);
 		ret = afs_dynroot_readdir_cells(net, ctx);
-		rcu_read_unlock();
+		up_read(&net->cells_lock);
 	}
 	return ret;
 }


  parent reply	other threads:[~2025-03-31  8:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-27 16:27 [syzbot] [afs?] [ntfs3?] BUG: sleeping function called from invalid context in ovl_cache_entry_new syzbot
2025-03-28 17:46 ` David Howells
2025-03-28 18:28   ` syzbot
2025-03-29  2:53 ` [syzbot] [afs?] BUG: sleeping function called from invalid context in __alloc_frozen_pages_noprof Edward Adam Davis
2025-03-29  6:02   ` [syzbot] [afs?] [ntfs3?] BUG: sleeping function called from invalid context in ovl_cache_entry_new syzbot
2025-03-31  8:06 ` David Howells [this message]
2025-03-31  8:38   ` syzbot
2025-03-31 11:07     ` Is "unregister_netdevice: waiting for batadv0 to become free" fixed somewhere else? David Howells

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=164841.1743408370@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.dionne@auristor.com \
    --cc=ntfs3@lists.linux.dev \
    --cc=syzbot+54e6c2176ba76c56217e@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.