From: Hyunchul Lee <hyc.lee@gmail.com>
To: Marios Makassikis <mmakassikis@freebox.fr>
Cc: linux-cifs <linux-cifs@vger.kernel.org>
Subject: Re: [PATCH 2/4] ksmbd-tools: Fix memory leak in lsarpc_lookup_names3_invoke
Date: Wed, 2 Mar 2022 08:11:09 +0900 [thread overview]
Message-ID: <CANFS6bbsTQ9fBhGhdr=BZYc5iGtNgZWwK2gV9Rf9JhMCu_q1rA@mail.gmail.com> (raw)
In-Reply-To: <20220301110006.4033351-2-mmakassikis@freebox.fr>
Looks good to me.
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
2022년 3월 1일 (화) 오후 10:58, Marios Makassikis <mmakassikis@freebox.fr>님이 작성:
>
> If usm_lookup_user() fails, the "ni" struct is leaked.
>
> Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
> ---
> mountd/rpc_lsarpc.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/mountd/rpc_lsarpc.c b/mountd/rpc_lsarpc.c
> index cc99a147b239..b9088950c46e 100644
> --- a/mountd/rpc_lsarpc.c
> +++ b/mountd/rpc_lsarpc.c
> @@ -357,8 +357,10 @@ static int lsarpc_lookup_names3_invoke(struct ksmbd_rpc_pipe *pipe)
> }
>
> ni->user = usm_lookup_user(name);
> - if (!ni->user)
> + if (!ni->user) {
> + free(ni);
> break;
> + }
> pipe->entries = g_array_append_val(pipe->entries, ni);
> pipe->num_entries++;
> smb_init_domain_sid(&ni->sid);
> --
> 2.25.1
>
--
Thanks,
Hyunchul
next prev parent reply other threads:[~2022-03-01 23:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-01 11:00 [PATCH 1/4] ksmbd-tools: Fix function name typo Marios Makassikis
2022-03-01 11:00 ` [PATCH 2/4] ksmbd-tools: Fix memory leak in lsarpc_lookup_names3_invoke Marios Makassikis
2022-03-01 23:11 ` Hyunchul Lee [this message]
2022-03-01 11:00 ` [PATCH 3/4] ksmbd-tools: Add validation for ndr_read_* functions Marios Makassikis
2022-03-01 23:12 ` Hyunchul Lee
2022-03-01 11:00 ` [PATCH 4/4] ksmbd-tools: Fix potential out-of-bounds write in ndr_write_* Marios Makassikis
2022-03-01 23:12 ` Hyunchul Lee
2022-03-01 23:11 ` [PATCH 1/4] ksmbd-tools: Fix function name typo Hyunchul Lee
2022-03-03 0:00 ` 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='CANFS6bbsTQ9fBhGhdr=BZYc5iGtNgZWwK2gV9Rf9JhMCu_q1rA@mail.gmail.com' \
--to=hyc.lee@gmail.com \
--cc=linux-cifs@vger.kernel.org \
--cc=mmakassikis@freebox.fr \
/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;
as well as URLs for NNTP newsgroup(s).