Patch "NFSv4.1 enforce rootpath check in fs_location query" has been added to the 6.6-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    NFSv4.1 enforce rootpath check in fs_location query

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     nfsv4.1-enforce-rootpath-check-in-fs_location-query.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3d3cc7525df822588be50b833b503b6beedd50df
Author: Olga Kornievskaia <kolga@xxxxxxxxxx>
Date:   Wed May 29 15:44:35 2024 -0400

    NFSv4.1 enforce rootpath check in fs_location query
    
    [ Upstream commit 28568c906c1bb5f7560e18082ed7d6295860f1c2 ]
    
    In commit 4ca9f31a2be66 ("NFSv4.1 test and add 4.1 trunking transport"),
    we introduce the ability to query the NFS server for possible trunking
    locations of the existing filesystem. However, we never checked the
    returned file system path for these alternative locations. According
    to the RFC, the server can say that the filesystem currently known
    under "fs_root" of fs_location also resides under these server
    locations under the following "rootpath" pathname. The client cannot
    handle trunking a filesystem that reside under different location
    under different paths other than what the main path is. This patch
    enforces the check that fs_root path and rootpath path in fs_location
    reply is the same.
    
    Fixes: 4ca9f31a2be6 ("NFSv4.1 test and add 4.1 trunking transport")
    Signed-off-by: Olga Kornievskaia <kolga@xxxxxxxxxx>
    Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 41b7eafbd9287..f0953200acd08 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4003,6 +4003,23 @@ static void test_fs_location_for_trunking(struct nfs4_fs_location *location,
 	}
 }
 
+static bool _is_same_nfs4_pathname(struct nfs4_pathname *path1,
+				   struct nfs4_pathname *path2)
+{
+	int i;
+
+	if (path1->ncomponents != path2->ncomponents)
+		return false;
+	for (i = 0; i < path1->ncomponents; i++) {
+		if (path1->components[i].len != path2->components[i].len)
+			return false;
+		if (memcmp(path1->components[i].data, path2->components[i].data,
+				path1->components[i].len))
+			return false;
+	}
+	return true;
+}
+
 static int _nfs4_discover_trunking(struct nfs_server *server,
 				   struct nfs_fh *fhandle)
 {
@@ -4036,9 +4053,13 @@ static int _nfs4_discover_trunking(struct nfs_server *server,
 	if (status)
 		goto out_free_3;
 
-	for (i = 0; i < locations->nlocations; i++)
+	for (i = 0; i < locations->nlocations; i++) {
+		if (!_is_same_nfs4_pathname(&locations->fs_path,
+					&locations->locations[i].rootpath))
+			continue;
 		test_fs_location_for_trunking(&locations->locations[i], clp,
 					      server);
+	}
 out_free_3:
 	kfree(locations->fattr);
 out_free_2:




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux