[PATCH 25/31] xfs: actually check the fsid of a handle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

Compare the fsid of a handle to m_fixedfsid so that we don't try to open
a handle from the wrong fs and get lucky if the ino/gen happen to match.

Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
---
 fs/xfs/xfs_handle.c |    4 ++++
 1 file changed, 4 insertions(+)


diff --git a/fs/xfs/xfs_handle.c b/fs/xfs/xfs_handle.c
index b9f4d9860682a..417e4a1f5e6cb 100644
--- a/fs/xfs/xfs_handle.c
+++ b/fs/xfs/xfs_handle.c
@@ -163,6 +163,7 @@ xfs_khandle_to_dentry(
 		.ino		= handle->ha_fid.fid_ino,
 		.gen		= handle->ha_fid.fid_gen,
 	};
+	struct xfs_mount	*mp = XFS_I(file_inode(file))->i_mount;
 
 	/*
 	 * Only allow handle opens under a directory.
@@ -170,6 +171,9 @@ xfs_khandle_to_dentry(
 	if (!S_ISDIR(file_inode(file)->i_mode))
 		return ERR_PTR(-ENOTDIR);
 
+	if (memcmp(&handle->ha_fsid, mp->m_fixedfsid, sizeof(struct xfs_fsid)))
+		return ERR_PTR(-ESTALE);
+
 	if (handle->ha_fid.fid_len != xfs_filehandle_fid_len())
 		return ERR_PTR(-EINVAL);
 





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux