]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nfs: fix acl memory leak of posix_acl_create()
authorGao Xiang <hsiangkao@linux.alibaba.com>
Fri, 18 Jun 2021 04:20:55 +0000 (12:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:02:19 +0000 (16:02 +0200)
[ Upstream commit 1fcb6fcd74a222d9ead54d405842fc763bb86262 ]

When looking into another nfs xfstests report, I found acl and
default_acl in nfs3_proc_create() and nfs3_proc_mknod() error
paths are possibly leaked. Fix them in advance.

Fixes: 013cdf1088d7 ("nfs: use generic posix ACL infrastructure for v3 Posix ACLs")
Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: Anna Schumaker <anna.schumaker@netapp.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/nfs3proc.c

index 5c4e23abc3451bc6a47fe9f0b7e5c956ce7e3de6..2299446b3b89bb7ef1c9274abbfbc3c9634ae4ef 100644 (file)
@@ -385,7 +385,7 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
                                break;
 
                        case NFS3_CREATE_UNCHECKED:
-                               goto out;
+                               goto out_release_acls;
                }
                nfs_fattr_init(data->res.dir_attr);
                nfs_fattr_init(data->res.fattr);
@@ -751,7 +751,7 @@ nfs3_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
                break;
        default:
                status = -EINVAL;
-               goto out;
+               goto out_release_acls;
        }
 
        d_alias = nfs3_do_create(dir, dentry, data);