Patch "nfsd: fix NULL dereference in nfs3svc_encode_getaclres" has been added to the 5.10-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

    nfsd: fix NULL dereference in nfs3svc_encode_getaclres

to the 5.10-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:
     nfsd-fix-null-dereference-in-nfs3svc_encode_getaclre.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 96da2a81e336e60e8142e01f9d6f26a8a5040395
Author: J. Bruce Fields <bfields@xxxxxxxxxxxx>
Date:   Thu Jul 1 20:06:56 2021 -0400

    nfsd: fix NULL dereference in nfs3svc_encode_getaclres
    
    [ Upstream commit ab1016d39cc052064e32f25ad18ef8767a0ee3b8 ]
    
    In error cases the dentry may be NULL.
    
    Before 20798dfe249a, the encoder also checked dentry and
    d_really_is_positive(dentry), but that looks like overkill to me--zero
    status should be enough to guarantee a positive dentry.
    
    This isn't the first time we've seen an error-case NULL dereference
    hidden in the initialization of a local variable in an xdr encoder.  But
    I went back through the other recent rewrites and didn't spot any
    similar bugs.
    
    Reported-by: JianHong Yin <jiyin@xxxxxxxxxx>
    Reviewed-by: Chuck Lever III <chuck.lever@xxxxxxxxxx>
    Fixes: 20798dfe249a ("NFSD: Update the NFSv3 GETACL result encoder...")
    Signed-off-by: J. Bruce Fields <bfields@xxxxxxxxxx>
    Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c
index cfb686f23e571..5e13e5f7f92b8 100644
--- a/fs/nfsd/nfs3acl.c
+++ b/fs/nfsd/nfs3acl.c
@@ -170,7 +170,7 @@ static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p)
 	struct nfsd3_getaclres *resp = rqstp->rq_resp;
 	struct dentry *dentry = resp->fh.fh_dentry;
 	struct kvec *head = rqstp->rq_res.head;
-	struct inode *inode = d_inode(dentry);
+	struct inode *inode;
 	unsigned int base;
 	int n;
 	int w;
@@ -179,6 +179,7 @@ static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p)
 		return 0;
 	switch (resp->status) {
 	case nfs_ok:
+		inode = d_inode(dentry);
 		if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh))
 			return 0;
 		if (xdr_stream_encode_u32(xdr, resp->mask) < 0)




[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