From: Jeff Layton <jlayton@redhat.com>
To: Cong Ding <dinggnu@gmail.com>
Cc: Steve French <sfrench@samba.org>,
linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs/cifs/cifs_dfs_ref.c: fix potential memory leakage
Date: Tue, 22 Jan 2013 20:36:03 -0500 [thread overview]
Message-ID: <20130122203603.1bd26363@corrin.poochiereds.net> (raw)
In-Reply-To: <1358900459-26277-1-git-send-email-dinggnu@gmail.com>
On Tue, 22 Jan 2013 19:20:58 -0500
Cong Ding <dinggnu@gmail.com> wrote:
> When it goes to error through line 144, the memory allocated to *devname is
> not freed, and the caller doesn't free it either in line 250. So we free the
> memroy of *devname in function cifs_compose_mount_options() when it goes to
> error.
>
> Signed-off-by: Cong Ding <dinggnu@gmail.com>
> ---
> fs/cifs/cifs_dfs_ref.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
> index ce5cbd7..210fce2 100644
> --- a/fs/cifs/cifs_dfs_ref.c
> +++ b/fs/cifs/cifs_dfs_ref.c
> @@ -226,6 +226,8 @@ compose_mount_options_out:
> compose_mount_options_err:
> kfree(mountdata);
> mountdata = ERR_PTR(rc);
> + kfree(*devname);
> + *devname = NULL;
> goto compose_mount_options_out;
> }
>
Nice catch. Looks correct to me. Should this also go to stable?
Reviewed-by: Jeff Layton <jlayton@redhat.com>
next prev parent reply other threads:[~2013-01-23 1:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-23 0:20 Cong Ding
2013-01-23 1:36 ` Jeff Layton [this message]
2013-01-23 5:59 ` Steve French
2013-01-23 6:00 ` Steve French
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=20130122203603.1bd26363@corrin.poochiereds.net \
--to=jlayton@redhat.com \
--cc=dinggnu@gmail.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=samba-technical@lists.samba.org \
--cc=sfrench@samba.org \
/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
Powered by JetHome