All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] regmap: Do not call regcache_exit from regcache_lzo_init error path
Date: Mon, 14 Nov 2011 15:45:36 +0000	[thread overview]
Message-ID: <20111114154536.GB12690@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1321263619-25891-5-git-send-email-lars@metafoo.de>

On Mon, Nov 14, 2011 at 10:40:19AM +0100, Lars-Peter Clausen wrote:
> Calling regcache_exit from regcache_lzo_init is a layering violation and
> might cause double frees. In case of an error only free those structures which
> have been allocated in this function.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
>  drivers/base/regmap/regcache-lzo.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/base/regmap/regcache-lzo.c b/drivers/base/regmap/regcache-lzo.c
> index 226ffc1..b7d1614 100644
> --- a/drivers/base/regmap/regcache-lzo.c
> +++ b/drivers/base/regmap/regcache-lzo.c
> @@ -15,6 +15,8 @@
>  
>  #include "internal.h"
>  
> +static int regcache_lzo_exit(struct regmap *map);
> +
>  struct regcache_lzo_ctx {
>  	void *wmem;
>  	void *dst;
> @@ -193,7 +195,7 @@ static int regcache_lzo_init(struct regmap *map)
>  
>  	return 0;
>  err:
> -	regcache_exit(map);
> +	regcache_lzo_exit(map);
>  	return ret;
>  }
>  
> -- 
> 1.7.7.1
> 
> 

All of them look good.

Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>

  reply	other threads:[~2011-11-14 15:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-14  9:40 [PATCH 1/5] regmap: return ERR_PTR instead of NULL in regmap_init Lars-Peter Clausen
2011-11-14  9:40 ` [PATCH 2/5] regmap: Fix memory leak in regcache_hw_init error path Lars-Peter Clausen
2011-11-14 21:45   ` Mark Brown
2011-11-14  9:40 ` [PATCH 3/5] regmap: Fix memory leak in regcache_init " Lars-Peter Clausen
2011-11-14 21:45   ` Mark Brown
2011-11-14  9:40 ` [PATCH 4/5] regmap: Do not call regcache_exit from regcache_rbtree_init " Lars-Peter Clausen
2011-11-14  9:40 ` [PATCH 5/5] regmap: Do not call regcache_exit from regcache_lzo_init " Lars-Peter Clausen
2011-11-14 15:45   ` Dimitris Papastamos [this message]
2011-11-14 21:43   ` Mark Brown
2011-11-15 12:34     ` [PATCH 1/2] regmap: Do not call regcache_exit from regcache_rbtree_init " Lars-Peter Clausen
2011-11-15 12:34       ` [PATCH 2/2] regmap: Do not call regcache_exit from regcache_lzo_init " Lars-Peter Clausen
2011-11-15 19:23       ` [PATCH 1/2] regmap: Do not call regcache_exit from regcache_rbtree_init " Mark Brown
2011-11-14 15:44 ` [PATCH 1/5] regmap: return ERR_PTR instead of NULL in regmap_init Dimitris Papastamos
2011-11-14 21:44 ` Mark Brown

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=20111114154536.GB12690@opensource.wolfsonmicro.com \
    --to=dp@opensource.wolfsonmicro.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.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 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.