This is a note to let you know that I've just added the patch titled ksmbd: fix possible refcount leak in smb2_open() to the 6.2-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: ksmbd-fix-possible-refcount-leak-in-smb2_open.patch and it can be found in the queue-6.2 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit de88720fe57ad642ff9382dd334fb4d6ad5d32e0 Author: ChenXiaoSong <chenxiaosong2@xxxxxxxxxx> Date: Thu Mar 2 21:58:04 2023 +0800 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@xxxxxxxxxx> Acked-by: Namjae Jeon <linkinjeon@xxxxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index b553d93a94eb5..89724cc62299c 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -2996,8 +2996,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,