All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kmemleak: do not leak object after tree insertion error (v2, fixed)
Date: Wed, 18 Apr 2012 15:40:44 +0100	[thread overview]
Message-ID: <20120418144043.GH1505@arm.com> (raw)
In-Reply-To: <20120402230656.GA4353@swordfish>

On Tue, Apr 03, 2012 at 12:06:56AM +0100, Sergey Senozhatsky wrote:
> [PATCH] kmemleak: do not leak object after tree insertion error
> 
> In case when tree insertion fails due to already existing object
> error, pointer to allocated object gets lost due to lookup_object()
> overwrite. Free allocated object and return the existing one, 
> obtained from lookup_object().

We really need to return NULL if the tree insertion fails as kmemleak is
disabled in this case (fatal condition for kmemleak). So we could just
call kmem_cache_free(object_cache, object) in the 'if' block.

-- 
Catalin

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kmemleak: do not leak object after tree insertion error (v2, fixed)
Date: Wed, 18 Apr 2012 15:40:44 +0100	[thread overview]
Message-ID: <20120418144043.GH1505@arm.com> (raw)
In-Reply-To: <20120402230656.GA4353@swordfish>

On Tue, Apr 03, 2012 at 12:06:56AM +0100, Sergey Senozhatsky wrote:
> [PATCH] kmemleak: do not leak object after tree insertion error
> 
> In case when tree insertion fails due to already existing object
> error, pointer to allocated object gets lost due to lookup_object()
> overwrite. Free allocated object and return the existing one, 
> obtained from lookup_object().

We really need to return NULL if the tree insertion fails as kmemleak is
disabled in this case (fatal condition for kmemleak). So we could just
call kmem_cache_free(object_cache, object) in the 'if' block.

-- 
Catalin

  reply	other threads:[~2012-04-18 14:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-02 23:06 [PATCH] kmemleak: do not leak object after tree insertion error (v2, fixed) Sergey Senozhatsky
2012-04-02 23:06 ` Sergey Senozhatsky
2012-04-18 14:40 ` Catalin Marinas [this message]
2012-04-18 14:40   ` Catalin Marinas
2012-04-18 15:29   ` Sergey Senozhatsky
2012-04-18 15:29     ` Sergey Senozhatsky

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=20120418144043.GH1505@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sergey.senozhatsky@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.