Patch "NFSv4.2 fix problems with __nfs42_ssc_open" 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

    NFSv4.2 fix problems with __nfs42_ssc_open

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:
     nfsv4.2-fix-problems-with-__nfs42_ssc_open.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 0780e4e360ab25b6574c2d5934821d7805b3f2e2
Author: Olga Kornievskaia <kolga@xxxxxxxxxx>
Date:   Thu Aug 18 15:07:05 2022 -0400

    NFSv4.2 fix problems with __nfs42_ssc_open
    
    [ Upstream commit fcfc8be1e9cf2f12b50dce8b579b3ae54443a014 ]
    
    A destination server while doing a COPY shouldn't accept using the
    passed in filehandle if its not a regular filehandle.
    
    If alloc_file_pseudo() has failed, we need to decrement a reference
    on the newly created inode, otherwise it leaks.
    
    Reported-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
    Fixes: ec4b092508982 ("NFS: inter ssc open")
    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/nfs4file.c b/fs/nfs/nfs4file.c
index 61ee03c8bcd2d..14f2efdecc2f8 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -339,6 +339,11 @@ static struct file *__nfs42_ssc_open(struct vfsmount *ss_mnt,
 		goto out;
 	}
 
+	if (!S_ISREG(fattr->mode)) {
+		res = ERR_PTR(-EBADF);
+		goto out;
+	}
+
 	res = ERR_PTR(-ENOMEM);
 	len = strlen(SSC_READ_NAME_BODY) + 16;
 	read_name = kzalloc(len, GFP_NOFS);
@@ -357,6 +362,7 @@ static struct file *__nfs42_ssc_open(struct vfsmount *ss_mnt,
 				     r_ino->i_fop);
 	if (IS_ERR(filep)) {
 		res = ERR_CAST(filep);
+		iput(r_ino);
 		goto out_free_name;
 	}
 	filep->f_mode |= FMODE_READ;



[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