[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251210193728.251147-1-dkarn@redhat.com>
Date: Thu, 11 Dec 2025 01:07:28 +0530
From: Deepakkumar Karn <dkarn@...hat.com>
To: David Howells <dhowells@...hat.com>
Cc: Marc Dionne <marc.dionne@...istor.com>,
Christian Brauner <brauner@...nel.org>,
Jan Kara <jack@...e.cz>,
linux-afs@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Deepakkumar Karn <dkarn@...hat.com>
Subject: [PATCH] afs: Remove setting of AS_RELEASE_ALWAYS for symlinks and mountpoints
Regular AFS files correctly use afs_file_aops which have release_folio
set as netfs_release_folio, so AS_RELEASE_ALWAYS is valid for them
when fscache is enabled (set viaafs_vnode_set_cache()).
Symlinks and mountpoints in AFS use afs_dir_aops, which does not provide
a release_folio callback. However, afs_apply_status() unconditionally
calls mapping_set_release_always() for these.
In such case when memory management code attempts to release folios,
filemap_release_folio() checks folio_needs_release() which
returns true due to AS_RELEASE_ALWAYS being set. Since there is no
release_folio callback, it falls through to try_to_free_buffers(),
which at present expects buffer_heads to be not null. For symlinks
and mountpoints without buffer_heads, this causes pointer dereference.
Fixes: eae9e78951bb ("afs: Use netfslib for symlinks, allowing them to be cached")
Signed-off-by: Deepakkumar Karn <dkarn@...hat.com>
---
fs/afs/inode.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index dde1857fcabb..463159f941fc 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -216,7 +216,6 @@ static int afs_inode_init_from_status(struct afs_operation *op,
}
inode->i_mapping->a_ops = &afs_dir_aops;
inode_nohighmem(inode);
- mapping_set_release_always(inode->i_mapping);
break;
default:
dump_vnode(vnode, op->file[0].vnode != vnode ? op->file[0].vnode : NULL);
--
2.52.0
Powered by blists - more mailing lists