From: ChenXiaoSong <chenxiaosong2@huawei.com>
To: <linkinjeon@kernel.org>, <sfrench@samba.org>,
<senozhatsky@chromium.org>, <lsahlber@redhat.com>,
<hyc.lee@gmail.com>
Cc: <linux-cifs@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<chenxiaosong2@huawei.com>, <yi.zhang@huawei.com>,
<zhangxiaoxu5@huawei.com>, <yanaijie@huawei.com>
Subject: [PATCH] ksmbd: fix possible refcount leak in smb2_open()
Date: Thu, 2 Mar 2023 21:58:04 +0800 [thread overview]
Message-ID: <20230302135804.2583061-1-chenxiaosong2@huawei.com> (raw)
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>
---
fs/ksmbd/smb2pdu.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index 0685c1c77b9f..f04d810a2588 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -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,
--
2.31.1
next reply other threads:[~2023-03-02 12:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 13:58 ChenXiaoSong [this message]
2023-03-07 8:52 ` [PATCH] ksmbd: fix possible refcount leak in smb2_open() ChenXiaoSong
2023-03-07 9:27 ` Namjae Jeon
2023-03-07 9:23 ` Namjae Jeon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230302135804.2583061-1-chenxiaosong2@huawei.com \
--to=chenxiaosong2@huawei.com \
--cc=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lsahlber@redhat.com \
--cc=senozhatsky@chromium.org \
--cc=sfrench@samba.org \
--cc=yanaijie@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=zhangxiaoxu5@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox