Commit 2624b445 authored by ChenXiaoSong's avatar ChenXiaoSong Committed by Steve French
Browse files

ksmbd: fix possible refcount leak in smb2_open()



Reference count of acls will leak when memory allocation fails. Fix this
by adding the missing posix_acl_release().

Fixes: e2f34481 ("cifsd: add server-side procedures for SMB3")
Signed-off-by: default avatarChenXiaoSong <chenxiaosong2@huawei.com>
Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 342edb60
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2977,8 +2977,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(idmap,
							    pntsd, NULL, 0,