Patch "NFS: LOOKUP_DIRECTORY is also ok with symlinks" has been added to the 5.15-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

    NFS: LOOKUP_DIRECTORY is also ok with symlinks

to the 5.15-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:
     nfs-lookup_directory-is-also-ok-with-symlinks.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 5144a1613a55e6a69b427e39e1f8ce61af8c79db
Author: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
Date:   Tue Feb 8 13:38:23 2022 -0500

    NFS: LOOKUP_DIRECTORY is also ok with symlinks
    
    [ Upstream commit e0caaf75d443e02e55e146fd75fe2efc8aed5540 ]
    
    Commit ac795161c936 (NFSv4: Handle case where the lookup of a directory
    fails) [1], part of Linux since 5.17-rc2, introduced a regression, where
    a symbolic link on an NFS mount to a directory on another NFS does not
    resolve(?) the first time it is accessed:
    
    Reported-by: Paul Menzel <pmenzel@xxxxxxxxxxxxx>
    Fixes: ac795161c936 ("NFSv4: Handle case where the lookup of a directory fails")
    Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
    Tested-by: Donald Buczek <buczek@xxxxxxxxxxxxx>
    Signed-off-by: Anna Schumaker <Anna.Schumaker@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index f6381c675cbe9..9adc6f57a0083 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1987,14 +1987,14 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
 	if (!res) {
 		inode = d_inode(dentry);
 		if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
-		    !S_ISDIR(inode->i_mode))
+		    !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)))
 			res = ERR_PTR(-ENOTDIR);
 		else if (inode && S_ISREG(inode->i_mode))
 			res = ERR_PTR(-EOPENSTALE);
 	} else if (!IS_ERR(res)) {
 		inode = d_inode(res);
 		if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
-		    !S_ISDIR(inode->i_mode)) {
+		    !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) {
 			dput(res);
 			res = ERR_PTR(-ENOTDIR);
 		} else if (inode && S_ISREG(inode->i_mode)) {



[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