ntfs3.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Kari Argillander <kari.argillander@gmail.com>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 3/4] fs/ntfs3: Check new size for limits
Date: Wed, 27 Oct 2021 00:22:34 +0300	[thread overview]
Message-ID: <20211026212234.nfxb7fikbw2seksh@kari-VirtualBox> (raw)
In-Reply-To: <512a989d-c15f-d73f-09c1-74ba25eeec27@paragon-software.com>

On Mon, Oct 25, 2021 at 07:59:26PM +0300, Konstantin Komarov wrote:
> We must check size before trying to allocate.
> Size can be set for example by "ulimit -f".
> Fixes xfstest generic/228

generic/228		[21:20:39][   18.058334] run fstests generic/228 at 2021-10-26 21:20:39
 [21:20:41] 2s
Ran: generic/228
Passed all 1 tests

> Fixes: 4342306f0f0d ("fs/ntfs3: Add file operations and implementation")
> 
> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>

Reviewed-by: Kari Argillander <kari.argillander@gmail.com>

> ---
>  fs/ntfs3/file.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
> index 5418e5ba64b3..efb3110e1790 100644
> --- a/fs/ntfs3/file.c
> +++ b/fs/ntfs3/file.c
> @@ -661,7 +661,13 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
>  		/*
>  		 * Normal file: Allocate clusters, do not change 'valid' size.
>  		 */
> -		err = ntfs_set_size(inode, max(end, i_size));
> +		loff_t new_size = max(end, i_size);
> +
> +		err = inode_newsize_ok(inode, new_size);
> +		if (err)
> +			goto out;
> +
> +		err = ntfs_set_size(inode, new_size);
>  		if (err)
>  			goto out;
>  
> -- 
> 2.33.0
> 
> 

  reply	other threads:[~2021-10-26 21:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 16:57 [PATCH 0/4] fs/ntfs3: Various fixes for xfstests problems Konstantin Komarov
2021-10-25 16:58 ` [PATCH 1/4] fs/ntfs3: In function ntfs_set_acl_ex do not change inode->i_mode if called from function ntfs_init_acl Konstantin Komarov
2021-10-25 17:13   ` Joe Perches
2021-10-26 18:40   ` Kari Argillander
2021-10-25 16:58 ` [PATCH 2/4] fs/ntfs3: Fix fiemap + fix shrink file size (to remove preallocated space) Konstantin Komarov
2021-10-26 21:18   ` Kari Argillander
2021-10-25 16:59 ` [PATCH 3/4] fs/ntfs3: Check new size for limits Konstantin Komarov
2021-10-26 21:22   ` Kari Argillander [this message]
2021-10-25 16:59 ` [PATCH 4/4] fs/ntfs3: Update valid size if -EIOCBQUEUED Konstantin Komarov
2021-10-26 21:31   ` Kari Argillander
2021-10-26 21:37 ` [PATCH 0/4] fs/ntfs3: Various fixes for xfstests problems Kari Argillander

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=20211026212234.nfxb7fikbw2seksh@kari-VirtualBox \
    --to=kari.argillander@gmail.com \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    /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).