Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: ChenXiaoSong <chenxiaosong2@huawei.com>
To: <linkinjeon@kernel.org>, <sfrench@samba.org>, <stfrench@microsoft.com>
Cc: <linux-cifs@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ksmbd: fix possible refcount leak in smb2_open()
Date: Tue, 7 Mar 2023 16:52:42 +0800	[thread overview]
Message-ID: <48975544-9b5f-eb2a-e2a2-f0ffa537aa1c@huawei.com> (raw)
In-Reply-To: <20230302135804.2583061-1-chenxiaosong2@huawei.com>

Hi Namjae and Steve:

Do you have any suggestions for this patch?

在 2023/3/2 21:58, ChenXiaoSong 写道:
> 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,
> 

  reply	other threads:[~2023-03-07  8:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02 13:58 [PATCH] ksmbd: fix possible refcount leak in smb2_open() ChenXiaoSong
2023-03-07  8:52 ` ChenXiaoSong [this message]
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=48975544-9b5f-eb2a-e2a2-f0ffa537aa1c@huawei.com \
    --to=chenxiaosong2@huawei.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfrench@samba.org \
    --cc=stfrench@microsoft.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