Skip to content

Commit

Permalink
Merge tag 'vfs-6.14-final.fixes' of git://git.kernel.org/pub/scm/linu…
Browse files Browse the repository at this point in the history
…x/kernel/git/vfs/vfs

Pull vfs fixes from Christian Brauner:
 "A final set of fixes for this cycle:

  VFS:

   - Ensure that the stable offset api doesn't return duplicate
     directory entries when userspace has to perform the getdents call
     multiple times on large directories

  afs:

   - Prevent invalid pointer dereference during get_link RCU pathwalk

  fuse:

   - Fix deadlock caused by uninitialized rings when using io_uring with
     fuse

   - Handle race condition when using io_uring with fuse to prevent NULL
     dereference

  libnetfs:

   - Ensure that invalidate_cache is only called if implemented

   - Fix collection of results during pause when collection is
     offloaded

   - Ensure rolling_buffer_load_from_ra() doesn't clear mark bits

   - Make netfs_unbuffered_read() return ssize_t rather than int"

* tag 'vfs-6.14-final.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  libfs: Fix duplicate directory entry in offset_dir_lookup
  fuse: fix possible deadlock if rings are never initialized
  netfs: Fix netfs_unbuffered_read() to return ssize_t rather than int
  netfs: Fix rolling_buffer_load_from_ra() to not clear mark bits
  netfs: Call `invalidate_cache` only if implemented
  netfs: Fix collection of results during pause when collection offloaded
  fuse: fix uring race condition for null dereference of fc
  afs: Fix afs_atcell_get_link() to check if ws_cell is unset first
  • Loading branch information
Linus Torvalds committed Mar 20, 2025
2 parents f45f8f0 + f70681e commit b5329d5
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 23 deletions.
6 changes: 3 additions & 3 deletions fs/afs/dynroot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion fs/fuse/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void fuse_set_initialized(struct fuse_conn *fc)
static bool fuse_block_alloc(struct fuse_conn *fc, bool for_background)
{
return !fc->initialized || (for_background && fc->blocked) ||
(fc->io_uring && !fuse_uring_ready(fc));
(fc->io_uring && fc->connected && !fuse_uring_ready(fc));
}

static void fuse_drop_waiting(struct fuse_conn *fc)
Expand Down
4 changes: 2 additions & 2 deletions fs/fuse/dev_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc)

init_waitqueue_head(&ring->stop_waitq);

fc->ring = ring;
ring->nr_queues = nr_queues;
ring->fc = fc;
ring->max_payload_sz = max_payload_size;
atomic_set(&ring->queue_refs, 0);
smp_store_release(&fc->ring, ring);

spin_unlock(&fc->lock);
return ring;
Expand Down Expand Up @@ -1041,7 +1041,7 @@ static int fuse_uring_register(struct io_uring_cmd *cmd,
unsigned int issue_flags, struct fuse_conn *fc)
{
const struct fuse_uring_cmd_req *cmd_req = io_uring_sqe_cmd(cmd->sqe);
struct fuse_ring *ring = fc->ring;
struct fuse_ring *ring = smp_load_acquire(&fc->ring);
struct fuse_ring_queue *queue;
struct fuse_ring_ent *ent;
int err;
Expand Down
2 changes: 1 addition & 1 deletion fs/libfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ offset_dir_lookup(struct dentry *parent, loff_t offset)
found = find_positive_dentry(parent, NULL, false);
else {
rcu_read_lock();
child = mas_find(&mas, DIR_OFFSET_MAX);
child = mas_find_rev(&mas, DIR_OFFSET_MIN);
found = find_positive_dentry(parent, child, false);
rcu_read_unlock();
}
Expand Down
6 changes: 3 additions & 3 deletions fs/netfs/direct_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ static int netfs_dispatch_unbuffered_reads(struct netfs_io_request *rreq)
* Perform a read to an application buffer, bypassing the pagecache and the
* local disk cache.
*/
static int netfs_unbuffered_read(struct netfs_io_request *rreq, bool sync)
static ssize_t netfs_unbuffered_read(struct netfs_io_request *rreq, bool sync)
{
int ret;
ssize_t ret;

_enter("R=%x %llx-%llx",
rreq->debug_id, rreq->start, rreq->start + rreq->len - 1);
Expand Down Expand Up @@ -155,7 +155,7 @@ static int netfs_unbuffered_read(struct netfs_io_request *rreq, bool sync)
else
ret = -EIOCBQUEUED;
out:
_leave(" = %d", ret);
_leave(" = %zd", ret);
return ret;
}

Expand Down
18 changes: 10 additions & 8 deletions fs/netfs/read_collect.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,14 +682,16 @@ void netfs_wait_for_pause(struct netfs_io_request *rreq)
trace_netfs_rreq(rreq, netfs_rreq_trace_wait_queue);
prepare_to_wait(&rreq->waitq, &myself, TASK_UNINTERRUPTIBLE);

subreq = list_first_entry_or_null(&stream->subrequests,
struct netfs_io_subrequest, rreq_link);
if (subreq &&
(!test_bit(NETFS_SREQ_IN_PROGRESS, &subreq->flags) ||
test_bit(NETFS_SREQ_MADE_PROGRESS, &subreq->flags))) {
__set_current_state(TASK_RUNNING);
netfs_read_collection(rreq);
continue;
if (!test_bit(NETFS_RREQ_OFFLOAD_COLLECTION, &rreq->flags)) {
subreq = list_first_entry_or_null(&stream->subrequests,
struct netfs_io_subrequest, rreq_link);
if (subreq &&
(!test_bit(NETFS_SREQ_IN_PROGRESS, &subreq->flags) ||
test_bit(NETFS_SREQ_MADE_PROGRESS, &subreq->flags))) {
__set_current_state(TASK_RUNNING);
netfs_read_collection(rreq);
continue;
}
}

if (!test_bit(NETFS_RREQ_IN_PROGRESS, &rreq->flags) ||
Expand Down
4 changes: 0 additions & 4 deletions fs/netfs/rolling_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@ ssize_t rolling_buffer_load_from_ra(struct rolling_buffer *roll,

/* Store the counter after setting the slot. */
smp_store_release(&roll->next_head_slot, to);

for (; ix < folioq_nr_slots(fq); ix++)
folioq_clear(fq, ix);

return size;
}

Expand Down
3 changes: 2 additions & 1 deletion fs/netfs/write_collect.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ void netfs_write_collection_worker(struct work_struct *work)
trace_netfs_rreq(wreq, netfs_rreq_trace_write_done);

if (wreq->io_streams[1].active &&
wreq->io_streams[1].failed) {
wreq->io_streams[1].failed &&
ictx->ops->invalidate_cache) {
/* Cache write failure doesn't prevent writeback completion
* unless we're in disconnected mode.
*/
Expand Down

0 comments on commit b5329d5

Please sign in to comment.