Skip to content

Commit 2624b44

Browse files
ChenXiaoSongsmfrench
authored andcommitted
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: e2f3448 ("cifsd: add server-side procedures for SMB3") Signed-off-by: ChenXiaoSong <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 342edb6 commit 2624b44

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/ksmbd/smb2pdu.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2977,8 +2977,11 @@ int smb2_open(struct ksmbd_work *work)
29772977
sizeof(struct smb_acl) +
29782978
sizeof(struct smb_ace) * ace_num * 2,
29792979
GFP_KERNEL);
2980-
if (!pntsd)
2980+
if (!pntsd) {
2981+
posix_acl_release(fattr.cf_acls);
2982+
posix_acl_release(fattr.cf_dacls);
29812983
goto err_out;
2984+
}
29822985

29832986
rc = build_sec_desc(idmap,
29842987
pntsd, NULL, 0,

0 commit comments

Comments
 (0)