Linux filesystem development
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev,
	syzbot+3b6c5c6a1d0119b687a1@syzkaller.appspotmail.com,
	syzbot+8245611446194a52150d@syzkaller.appspotmail.com,
	syzbot+1aa62e6852a6ad1c7944@syzkaller.appspotmail.com,
	syzbot+54e6c2176ba76c56217e@syzkaller.appspotmail.com,
	David Howells <dhowells@redhat.com>,
	Marc Dionne <marc.dionne@auristor.com>,
	linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org,
	Christian Brauner <brauner@kernel.org>
Subject: [PATCH 6.12 1258/1276] afs: Fix afs_dynroot_readdir() to not use the RCU read lock
Date: Tue, 21 Jul 2026 17:28:21 +0200	[thread overview]
Message-ID: <20260721152514.244847397@linuxfoundation.org> (raw)
In-Reply-To: <20260721152446.065700225@linuxfoundation.org>

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Howells <dhowells@redhat.com>

commit a64e4d48a0b77e4ada19ac26ca3a08cd492f6362 upstream.

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.

This can be triggered by enabling lockdep, preconfiguring a number of
cells, doing "mount -t afs none /afs -o dyn" (or using the kafs-client
package with afs.mount systemd unit enabled) and then doing "ls /afs".

Fixes: 1d0b929fc070 ("afs: Change dynroot to create contents on demand")
Reported-by: syzbot+3b6c5c6a1d0119b687a1@syzkaller.appspotmail.com
Reported-by: syzbot+8245611446194a52150d@syzkaller.appspotmail.com
Reported-by: syzbot+1aa62e6852a6ad1c7944@syzkaller.appspotmail.com
Reported-by: syzbot+54e6c2176ba76c56217e@syzkaller.appspotmail.com
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/1638014.1744145189@warthog.procyon.org.uk
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/afs/dynroot.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/fs/afs/dynroot.c
+++ b/fs/afs/dynroot.c
@@ -347,9 +347,9 @@ static int afs_dynroot_readdir(struct fi
 	}
 
 	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:[~2026-07-21 20:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260721152446.065700225@linuxfoundation.org>
2026-07-21 15:19 ` [PATCH 6.12 0734/1276] afs: Fix afs_atcell_get_link() to handle RCU pathwalk Greg Kroah-Hartman
2026-07-21 15:19 ` [PATCH 6.12 0735/1276] afs: Remove the "autocell" mount option Greg Kroah-Hartman
2026-07-21 15:19 ` [PATCH 6.12 0736/1276] afs: Change dynroot to create contents on demand Greg Kroah-Hartman
2026-07-21 15:19 ` [PATCH 6.12 0745/1276] netfs: Fix writeback error handling Greg Kroah-Hartman
2026-07-21 15:19 ` [PATCH 6.12 0749/1276] netfs: Drop the error arg from netfs_read_subreq_terminated() Greg Kroah-Hartman
2026-07-21 15:19 ` [PATCH 6.12 0750/1276] cifs: Fix missing credit release on failure in cifs_issue_read() Greg Kroah-Hartman
2026-07-21 15:27 ` [PATCH 6.12 1200/1276] hfs/hfsplus: prevent getting negative values of offset/length Greg Kroah-Hartman
2026-07-21 15:28 ` [PATCH 6.12 1257/1276] afs: Fix afs_atcell_get_link() to check if ws_cell is unset first Greg Kroah-Hartman
2026-07-21 15:28 ` Greg Kroah-Hartman [this message]

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=20260721152514.244847397@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=brauner@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=marc.dionne@auristor.com \
    --cc=patches@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+1aa62e6852a6ad1c7944@syzkaller.appspotmail.com \
    --cc=syzbot+3b6c5c6a1d0119b687a1@syzkaller.appspotmail.com \
    --cc=syzbot+54e6c2176ba76c56217e@syzkaller.appspotmail.com \
    --cc=syzbot+8245611446194a52150d@syzkaller.appspotmail.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