From: Christoph Hellwig Date: Mon, 19 Feb 2024 06:27:11 +0000 (+0100) Subject: shmem: set a_ops earlier in shmem_symlink X-Git-Tag: v6.9-rc1~129^2~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e11381d83d72198565f4545d9988b4720288eb64;p=thirdparty%2Fkernel%2Flinux.git shmem: set a_ops earlier in shmem_symlink Set the a_ops in shmem_symlink before reading a folio from the mapping to prepare for asserting that shmem_get_folio is only called on shmem mappings. Signed-off-by: Christoph Hellwig Reviewed-by: "Matthew Wilcox (Oracle)" Signed-off-by: Chandan Babu R --- diff --git a/mm/shmem.c b/mm/shmem.c index f607b0cab7e4e..1900916aa84d1 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3506,10 +3506,10 @@ static int shmem_symlink(struct mnt_idmap *idmap, struct inode *dir, inode->i_op = &shmem_short_symlink_operations; } else { inode_nohighmem(inode); + inode->i_mapping->a_ops = &shmem_aops; error = shmem_get_folio(inode, 0, &folio, SGP_WRITE); if (error) goto out_remove_offset; - inode->i_mapping->a_ops = &shmem_aops; inode->i_op = &shmem_symlink_inode_operations; memcpy(folio_address(folio), symname, len); folio_mark_uptodate(folio);