mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Daeho Jeong <daeho43@gmail.com>,
	linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com
Cc: Daeho Jeong <daehojeong@google.com>
Subject: Re: [PATCH v2] f2fs: fix null page reference in redirty_blocks
Date: Tue, 5 Jan 2021 09:34:25 +0000	[thread overview]
Message-ID: <57be566b-89e2-04a1-9a8e-51e902fee96c@canonical.com> (raw)
In-Reply-To: <20210105041630.1393157-1-daeho43@gmail.com>

On 05/01/2021 04:16, Daeho Jeong wrote:
> 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);
> 
Thanks, looks good to me.

Reviewed-by: Colin Ian King <colin.king@canonical.com>

  parent reply	other threads:[~2021-01-05  9:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05  4:16 Daeho Jeong
2021-01-05  6:05 ` [f2fs-dev] " Chao Yu
2021-01-05  9:34 ` Colin Ian King [this message]
     [not found] ` <dba4be04-70dd-d48b-391c-1f2355591097@web.de>
2021-01-05 23:44   ` Daeho Jeong
2021-01-06  1:03   ` Chao Yu
2021-01-06  3:35     ` Daeho Jeong
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=57be566b-89e2-04a1-9a8e-51e902fee96c@canonical.com \
    --to=colin.king@canonical.com \
    --cc=daeho43@gmail.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

all inboxes | Powered by JetHome®