[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <156174687185.1557318.13703922197244050336.stgit@magnolia>
Date: Fri, 28 Jun 2019 11:34:31 -0700
From: "Darrick J. Wong" <darrick.wong@...cle.com>
To: matthew.garrett@...ula.com, yuchao0@...wei.com, tytso@....edu,
darrick.wong@...cle.com, shaggy@...nel.org,
ard.biesheuvel@...aro.org, josef@...icpanda.com, hch@...radead.org,
clm@...com, adilger.kernel@...ger.ca, jk@...abs.org, jack@...e.com,
dsterba@...e.com, jaegeuk@...nel.org, viro@...iv.linux.org.uk
Cc: cluster-devel@...hat.com, jfs-discussion@...ts.sourceforge.net,
linux-efi@...r.kernel.org, reiserfs-devel@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net, linux-xfs@...r.kernel.org,
linux-nilfs@...r.kernel.org, linux-mtd@...ts.infradead.org,
ocfs2-devel@....oracle.com, linux-fsdevel@...r.kernel.org,
linux-ext4@...r.kernel.org, linux-btrfs@...r.kernel.org
Subject: [PATCH 5/5] vfs: only allow FSSETXATTR to set DAX flag on files and
dirs
From: Darrick J. Wong <darrick.wong@...cle.com>
The DAX flag only applies to files and directories, so don't let it get
set for other types of files.
Signed-off-by: Darrick J. Wong <darrick.wong@...cle.com>
---
fs/inode.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/inode.c b/fs/inode.c
index 670d5408d022..f08711b34341 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -2259,6 +2259,14 @@ int vfs_ioc_fssetxattr_check(struct inode *inode, const struct fsxattr *old_fa,
!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
return -EINVAL;
+ /*
+ * It is only valid to set the DAX flag on regular files and
+ * directories on filesystems.
+ */
+ if ((fa->fsx_xflags & FS_XFLAG_DAX) &&
+ !(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
+ return -EINVAL;
+
/* Extent size hints of zero turn off the flags. */
if (fa->fsx_extsize == 0)
fa->fsx_xflags &= ~(FS_XFLAG_EXTSIZE | FS_XFLAG_EXTSZINHERIT);
Powered by blists - more mailing lists