All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Dan Robertson <dan@dlrobertson.com>, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH v2 1/1] f2fs: check output position in move range ioctl
Date: Sun, 30 Aug 2020 11:39:35 +0800	[thread overview]
Message-ID: <7e444bc8-dec1-baf1-f56f-6e7d73f35e5e@kernel.org> (raw)
In-Reply-To: <20200830003520.6542-2-dan@dlrobertson.com>

On 2020-8-30 8:35, Dan Robertson wrote:
> When the move range ioctl is used, check the output position and ensure
> that it is a non-negative value. Without this check f2fs_get_dnode_of_data
> may hit a memmory bug.
>
> Signed-off-by: Dan Robertson <dan@dlrobertson.com>
> ---
>  fs/f2fs/file.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 8a422400e824..650ae0dc7cdf 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -2783,6 +2783,9 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in,
>  	if (IS_ENCRYPTED(src) || IS_ENCRYPTED(dst))
>  		return -EOPNOTSUPP;
>
> +	if (pos_out < 0)

if (pos_out < 0 || pos_in < 0)

> +		return -EINVAL;
> +
>  	if (src == dst) {
>  		if (pos_in == pos_out)
>  			return 0;
>


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

      reply	other threads:[~2020-08-30  3:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-30  0:35 [f2fs-dev] [PATCH v2 0/1] f2fs: check output position in move range ioctl Dan Robertson
2020-08-30  0:35 ` [f2fs-dev] [PATCH v2 1/1] " Dan Robertson
2020-08-30  3:39   ` Chao Yu [this message]

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=7e444bc8-dec1-baf1-f56f-6e7d73f35e5e@kernel.org \
    --to=chao@kernel.org \
    --cc=dan@dlrobertson.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.