diff options
author | ChenXiaoSong <chenxiaosong2@huawei.com> | 2023-03-02 16:58:04 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-30 13:49:10 +0300 |
commit | 303f8e58cc3ace744801dcdcabfc06ffc72ed62d (patch) | |
tree | e84cef3f49ee757827b0731e02215ddbebd1d991 /fs | |
parent | a4e6cd9253c8b6bf1f39c52cdb52355d28ad5ec9 (diff) | |
download | linux-303f8e58cc3ace744801dcdcabfc06ffc72ed62d.tar.xz |
ksmbd: fix possible refcount leak in smb2_open()
[ Upstream commit 2624b445544ffc1472ccabfb6ec867c199d4c95c ]
Reference count of acls will leak when memory allocation fails. Fix this
by adding the missing posix_acl_release().
Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Signed-off-by: ChenXiaoSong <chenxiaosong2@huawei.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ksmbd/smb2pdu.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index 61d12eab0be1..e8c051a3329e 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -2994,8 +2994,11 @@ int smb2_open(struct ksmbd_work *work) sizeof(struct smb_acl) + sizeof(struct smb_ace) * ace_num * 2, GFP_KERNEL); - if (!pntsd) + if (!pntsd) { + posix_acl_release(fattr.cf_acls); + posix_acl_release(fattr.cf_dacls); goto err_out; + } rc = build_sec_desc(user_ns, pntsd, NULL, 0, |