]> git.itanic.dy.fi Git - linux-stable/commit
f2fs: enforce the immutable flag on open files
authorChao Yu <yuchao0@huawei.com>
Sat, 26 Dec 2020 10:07:01 +0000 (18:07 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 10:38:43 +0000 (11:38 +0100)
commit04a495780f850570dd55fda1445d6f14acbc7fac
treed27e49c41f8b64cfb18ef6da1b22e8f04f4bc14e
parente391239dcd174dba5d92546efb8f4e2504c93cdf
f2fs: enforce the immutable flag on open files

commit e0fcd01510ad025c9bbce704c5c2579294056141 upstream.

This patch ports commit 02b016ca7f99 ("ext4: enforce the immutable
flag on open files") to f2fs.

According to the chattr man page, "a file with the 'i' attribute
cannot be modified..."  Historically, this was only enforced when the
file was opened, per the rest of the description, "... and the file
can not be opened in write mode".

There is general agreement that we should standardize all file systems
to prevent modifications even for files that were opened at the time
the immutable flag is set.  Eventually, a change to enforce this at
the VFS layer should be landing in mainline.

Cc: stable@kernel.org
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/f2fs/file.c