summaryrefslogtreecommitdiffstats
path: root/mm/shmem.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-02-19 07:27:11 +0100
committerChandan Babu R <chandanbabu@kernel.org>2024-02-21 11:36:50 +0530
commite11381d83d72198565f4545d9988b4720288eb64 (patch)
treedcd401b99fd45db7f5808e1f00093b5638b42501 /mm/shmem.c
parentaefacb2041f77784059b86c5fd151066859ad19a (diff)
downloadlinux-stable-e11381d83d72198565f4545d9988b4720288eb64.tar.gz
linux-stable-e11381d83d72198565f4545d9988b4720288eb64.tar.bz2
linux-stable-e11381d83d72198565f4545d9988b4720288eb64.zip
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 <hch@lst.de> Reviewed-by: "Matthew Wilcox (Oracle)" <willy@infradead.org> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Diffstat (limited to 'mm/shmem.c')
-rw-r--r--mm/shmem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index f607b0cab7e4..1900916aa84d 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);