From: Daejun Park <daejun7.park@samsung.com>
To: "jaegeuk@kernel.org" <jaegeuk@kernel.org>,
"chao@kernel.org" <chao@kernel.org>,
"linux-f2fs-devel@lists.sourceforge.net"
<linux-f2fs-devel@lists.sourceforge.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Daejun Park <daejun7.park@samsung.com>,
Dongjin Kim <dongjin_.kim@samsung.com>,
Seokhwan Kim <sukka.kim@samsung.com>,
Yonggil Song <yonggil.song@samsung.com>,
Eunhee Rho <eunhee83.rho@samsung.com>,
Jaeyoon Choi <j_yoon.choi@samsung.com>,
Nayeon Kim <nayeoni.kim@samsung.com>,
Siwoo Jung <siu.jung@samsung.com>
Subject: [PATCH] f2fs: fix convert inline inode on readonly mode
Date: Wed, 12 Jun 2024 11:20:12 +0900 [thread overview]
Message-ID: <20240612022012epcms2p77300b5130d18b0397c9fc2877704949d@epcms2p7> (raw)
In-Reply-To: <CGME20240612022012epcms2p77300b5130d18b0397c9fc2877704949d@epcms2p7>
syzbot reported a bug in f2fs_vm_page_mkwrite() which checks for
f2fs_has_inline_data(inode).
The bug was caused by f2fs_convert_inline_inode() not returning an
error when called on a read-only filesystem, but returning with the
inline attribute as set.
This patch fixes the problem by ensuring that f2fs_convert_inline_inode()
returns -EROFS on readonly.
Fixes: ec2ddf499402 ("f2fs: don't allow any writes on readonly mount")
Reported-by: syzbot+f195123a45ad487ca66c@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f195123a45ad487ca66c
Signed-off-by: Daejun Park <daejun7.park@samsung.com>
---
fs/f2fs/inline.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 7638d0d7b7ee..ae1d8f2d82c9 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -203,10 +203,12 @@ int f2fs_convert_inline_inode(struct inode *inode)
struct page *ipage, *page;
int err = 0;
- if (!f2fs_has_inline_data(inode) ||
- f2fs_hw_is_readonly(sbi) || f2fs_readonly(sbi->sb))
+ if (!f2fs_has_inline_data(inode))
return 0;
+ if (unlikely(f2fs_hw_is_readonly(sbi) || f2fs_readonly(sbi->sb)))
+ return -EROFS;
+
err = f2fs_dquot_initialize(inode);
if (err)
return err;
--
2.25.1
next parent reply other threads:[~2024-06-12 2:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240612022012epcms2p77300b5130d18b0397c9fc2877704949d@epcms2p7>
2024-06-12 2:20 ` Daejun Park [this message]
2024-06-12 3:39 ` Chao Yu
[not found] ` <CGME20240612022012epcms2p77300b5130d18b0397c9fc2877704949d@epcms2p2>
2024-06-12 4:50 ` Daejun Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240612022012epcms2p77300b5130d18b0397c9fc2877704949d@epcms2p7 \
--to=daejun7.park@samsung.com \
--cc=chao@kernel.org \
--cc=dongjin_.kim@samsung.com \
--cc=eunhee83.rho@samsung.com \
--cc=j_yoon.choi@samsung.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=nayeoni.kim@samsung.com \
--cc=siu.jung@samsung.com \
--cc=sukka.kim@samsung.com \
--cc=yonggil.song@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®