mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@cs.helsinki.fi>
To: Patrick Pannuto <ppannuto@codeaurora.org>
Cc: linux-kernel@vger.kernel.org, Mark Fasheh <mfasheh@suse.com>,
	Joel Becker <joel.becker@oracle.com>,
	Stephen Hemminger <shemminger@vyatta.com>,
	Jens Axboe <jens.axboe@oracle.com>,
	David Teigland <teigland@redhat.com>,
	ocfs2-devel@oss.oracle.com
Subject: Re: [PATCH 5/6] ocfs2: Fix memory leak on mlog_sys_init error path
Date: Fri, 23 Jul 2010 20:01:33 +0300	[thread overview]
Message-ID: <4C49CAED.6020304@cs.helsinki.fi> (raw)
In-Reply-To: <1279836546-26913-6-git-send-email-ppannuto@codeaurora.org>

Patrick Pannuto wrote:
> This leak is the same as the bus path; mlog_kset.kobj.name is
> set, but kset_register fails, thus nothing will ever call
> kset_unregister and name will be leaked
> 
> Signed-off-by: Patrick Pannuto <ppannuto@codeaurora.org>
> ---
>  fs/ocfs2/cluster/masklog.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c
> index c7fba39..de715d4 100644
> --- a/fs/ocfs2/cluster/masklog.c
> +++ b/fs/ocfs2/cluster/masklog.c
> @@ -154,6 +154,7 @@ static struct kset mlog_kset = {
>  int mlog_sys_init(struct kset *o2cb_kset)
>  {
>  	int i = 0;
> +	int ret;
>  
>  	while (mlog_attrs[i].attr.mode) {
>  		mlog_attr_ptrs[i] = &mlog_attrs[i].attr;
> @@ -163,7 +164,11 @@ int mlog_sys_init(struct kset *o2cb_kset)
>  
>  	kobject_set_name(&mlog_kset.kobj, "logmask");
>  	mlog_kset.kobj.kset = o2cb_kset;
> -	return kset_register(&mlog_kset);
> +
> +	ret = kset_register(&mlog_kset);
> +	if (ret)
> +		kfree(mlog_kset.kobj.name);

Aren't we supposed to use kobject_cleanup() here?

> +	return ret;
>  }
>  
>  void mlog_sys_shutdown(void)


  reply	other threads:[~2010-07-23 17:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-22 22:09 Possible memory leaks on driver core error paths Patrick Pannuto
2010-07-22 22:09 ` [PATCH 1/6] Driver core: Fix potential memory leak Patrick Pannuto
2010-07-22 23:39   ` Greg KH
2010-07-22 22:09 ` [PATCH 2/6] Driver core: Fix memory leak on bus_register error path Patrick Pannuto
2010-07-22 23:41   ` Greg KH
2010-07-24  1:19     ` Patrick Pannuto
2010-07-24  1:48       ` Patrick Pannuto
2010-07-27  0:00         ` Greg KH
2010-07-26 23:45       ` Greg KH
2010-07-22 22:09 ` [PATCH 3/6] Driver core: Fix memory leak on class_register " Patrick Pannuto
2010-07-22 23:41   ` Greg KH
2010-07-22 22:09 ` [PATCH 4/6] Driver core: Fix memory leak on sysdev_class_register " Patrick Pannuto
2010-07-22 23:41   ` Greg KH
2010-07-22 22:09 ` [PATCH 5/6] ocfs2: Fix memory leak on mlog_sys_init " Patrick Pannuto
2010-07-23 17:01   ` Pekka Enberg [this message]
2010-07-22 22:09 ` [PATCH 6/6] kobj: Fix memory leak on error path of kset_create_and_add Patrick Pannuto
2010-07-22 23:43   ` Greg KH

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=4C49CAED.6020304@cs.helsinki.fi \
    --to=penberg@cs.helsinki.fi \
    --cc=jens.axboe@oracle.com \
    --cc=joel.becker@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfasheh@suse.com \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=ppannuto@codeaurora.org \
    --cc=shemminger@vyatta.com \
    --cc=teigland@redhat.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

all inboxes | Powered by JetHome®