linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Frank Sorenson <sorenson@redhat.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH V2 2/2] fat: change timestamp updates to use fat_update_time
Date: Sun, 08 Apr 2018 09:17:48 +0900	[thread overview]
Message-ID: <87tvsmtutv.fsf@mail.parknet.co.jp> (raw)
In-Reply-To: <b5d7bf13-4e02-b485-3686-0bc4bd4f3eff@redhat.com> (Frank Sorenson's message of "Tue, 3 Apr 2018 21:37:20 -0500")

Frank Sorenson <sorenson@redhat.com> writes:

> diff --git a/fs/fat/file.c b/fs/fat/file.c
> index 63ec4a5bde77..b5495df1879b 100644
> --- a/fs/fat/file.c
> +++ b/fs/fat/file.c
> @@ -63,7 +63,8 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr)
>  
>  	/* Equivalent to a chmod() */
>  	ia.ia_valid = ATTR_MODE | ATTR_CTIME;
> -	ia.ia_ctime = current_time(inode);
> +	fat_update_time(inode, NULL, S_CTIME);
> +	ia.ia_ctime = inode->i_ctime;

This should not change inode->i_ctime before finishing all input validation.

>  	setattr_copy(inode, attr);
> +	fat_update_time(inode, &inode->i_mtime, S_MTIME);
> +	fat_update_time(inode, &inode->i_ctime, S_CTIME);
> +	fat_update_time(inode, &inode->i_atime, S_ATIME);

We probably should use timespec_trunc() for attr.ia_[acm]time
instead. In theory, temporary change to inode->i_[acm]time is visible to
user space.

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

      reply	other threads:[~2018-04-08  0:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-04  2:37 [PATCH V2 2/2] fat: change timestamp updates to use fat_update_time Frank Sorenson
2018-04-08  0:17 ` OGAWA Hirofumi [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=87tvsmtutv.fsf@mail.parknet.co.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sorenson@redhat.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;
as well as URLs for NNTP newsgroup(s).