Return-Path: Received: from mail.parknet.co.jp ([210.171.160.6]:42957 "EHLO mail.parknet.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752262AbeDHARu (ORCPT ); Sat, 7 Apr 2018 20:17:50 -0400 From: OGAWA Hirofumi To: Frank Sorenson Cc: linux-fsdevel@vger.kernel.org Subject: Re: [PATCH V2 2/2] fat: change timestamp updates to use fat_update_time References: Date: Sun, 08 Apr 2018 09:17:48 +0900 In-Reply-To: (Frank Sorenson's message of "Tue, 3 Apr 2018 21:37:20 -0500") Message-ID: <87tvsmtutv.fsf@mail.parknet.co.jp> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Frank Sorenson 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