* [f2fs-dev] [PATCH] f2fs: fix to check atomic_file in f2fs ioctl interfaces
@ 2024-09-04 3:20 Chao Yu via Linux-f2fs-devel
2024-09-16 21:30 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
0 siblings, 1 reply; 2+ messages in thread
From: Chao Yu via Linux-f2fs-devel @ 2024-09-04 3:20 UTC (permalink / raw)
To: jaegeuk; +Cc: linux-kernel, stable, linux-f2fs-devel
Some f2fs ioctl interfaces like f2fs_ioc_set_pin_file(),
f2fs_move_file_range(), and f2fs_defragment_range() missed to
check atomic_write status, which may cause potential race issue,
fix it.
Cc: stable@vger.kernel.org
Signed-off-by: Chao Yu <chao@kernel.org>
---
fs/f2fs/file.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index a8d153eb0a95..99903eafa7fe 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2710,7 +2710,8 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
(range->start + range->len) >> PAGE_SHIFT,
DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE));
- if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) {
+ if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED) ||
+ f2fs_is_atomic_file(inode)) {
err = -EINVAL;
goto unlock_out;
}
@@ -2943,6 +2944,11 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in,
goto out_unlock;
}
+ if (f2fs_is_atomic_file(src) || f2fs_is_atomic_file(dst)) {
+ ret = -EINVAL;
+ goto out_unlock;
+ }
+
ret = -EINVAL;
if (pos_in + len > src->i_size || pos_in + len < pos_in)
goto out_unlock;
@@ -3326,6 +3332,11 @@ static int f2fs_ioc_set_pin_file(struct file *filp, unsigned long arg)
inode_lock(inode);
+ if (f2fs_is_atomic_file(inode)) {
+ ret = -EINVAL;
+ goto out;
+ }
+
if (!pin) {
clear_inode_flag(inode, FI_PIN_FILE);
f2fs_i_gc_failures_write(inode, 0);
--
2.40.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [f2fs-dev] [PATCH] f2fs: fix to check atomic_file in f2fs ioctl interfaces
2024-09-04 3:20 [f2fs-dev] [PATCH] f2fs: fix to check atomic_file in f2fs ioctl interfaces Chao Yu via Linux-f2fs-devel
@ 2024-09-16 21:30 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+f2fs--- via Linux-f2fs-devel @ 2024-09-16 21:30 UTC (permalink / raw)
To: Chao Yu; +Cc: jaegeuk, linux-kernel, stable, linux-f2fs-devel
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:
On Wed, 4 Sep 2024 11:20:47 +0800 you wrote:
> Some f2fs ioctl interfaces like f2fs_ioc_set_pin_file(),
> f2fs_move_file_range(), and f2fs_defragment_range() missed to
> check atomic_write status, which may cause potential race issue,
> fix it.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Chao Yu <chao@kernel.org>
>
> [...]
Here is the summary with links:
- [f2fs-dev] f2fs: fix to check atomic_file in f2fs ioctl interfaces
https://git.kernel.org/jaegeuk/f2fs/c/bfe5c0265426
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-16 21:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04 3:20 [f2fs-dev] [PATCH] f2fs: fix to check atomic_file in f2fs ioctl interfaces Chao Yu via Linux-f2fs-devel
2024-09-16 21:30 ` patchwork-bot+f2fs--- via Linux-f2fs-devel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).