From: Daeho Jeong <daeho43@gmail.com>
To: linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com
Cc: Colin Ian King <colin.king@canonical.com>,
Daeho Jeong <daehojeong@google.com>
Subject: [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
Date: Tue, 5 Jan 2021 13:16:30 +0900 [thread overview]
Message-ID: <20210105041630.1393157-1-daeho43@gmail.com> (raw)
From: Daeho Jeong <daehojeong@google.com>
Fixed null page reference when find_lock_page() fails in
redirty_blocks().
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reported-by: Colin Ian King <colin.king@canonical.com>
Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE")
---
v2: changed error value and break the loop when error occurs
---
fs/f2fs/file.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 9e5275716be8..d27173c24391 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -4060,8 +4060,10 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len)
for (i = 0; i < page_len; i++, redirty_idx++) {
page = find_lock_page(mapping, redirty_idx);
- if (!page)
- ret = -ENOENT;
+ if (!page) {
+ ret = -ENOMEM;
+ break;
+ }
set_page_dirty(page);
f2fs_put_page(page, 1);
f2fs_put_page(page, 0);
--
2.29.2.729.g45daf8777d-goog
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next reply other threads:[~2021-01-05 4:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-05 4:16 Daeho Jeong [this message]
2021-01-05 6:05 ` [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks Chao Yu
2021-01-05 9:34 ` Colin Ian King
2021-01-05 12:04 ` Markus Elfring
2021-01-05 23:44 ` Daeho Jeong
2021-01-06 1:03 ` Chao Yu
2021-01-06 3:35 ` Daeho Jeong
-- strict thread matches above, loose matches on Subject: below --
2021-01-05 23:49 Daeho Jeong
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=20210105041630.1393157-1-daeho43@gmail.com \
--to=daeho43@gmail.com \
--cc=colin.king@canonical.com \
--cc=daehojeong@google.com \
--cc=kernel-team@android.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).