Linux PWM subsystem development
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Christian Engelmayer <cengelma@gmx.at>,
	Milo Kim <milo.kim@ti.com>,
	linux-pwm@vger.kernel.org
Subject: Re: [PATCH] pwm: lp3943: Fix potential memory leak during request
Date: Mon, 27 Jan 2014 09:58:03 +0000	[thread overview]
Message-ID: <20140127095803.GC14478@lee--X1> (raw)
In-Reply-To: <20140124162302.GA28335@ulmo.nvidia.com>

On Fri, 24 Jan 2014, Thierry Reding wrote:

> On Thu, Jan 23, 2014 at 10:32:20PM +0100, Christian Engelmayer wrote:
> > Fix a memory leak in the lp3943_pwm_request_map() error handling path.
> > Make sure already allocated pwm map memory is freed correctly.
> > Detected by Coverity: CID 1162829.
> > 
> > Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
> > ---
> >  drivers/pwm/pwm-lp3943.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c
> > index 8a843a0..a40b9c3 100644
> > --- a/drivers/pwm/pwm-lp3943.c
> > +++ b/drivers/pwm/pwm-lp3943.c
> > @@ -52,8 +52,10 @@ lp3943_pwm_request_map(struct lp3943_pwm *lp3943_pwm, int hwpwm)
> >  		offset = pwm_map->output[i];
> >  
> >  		/* Return an error if the pin is already assigned */
> > -		if (test_and_set_bit(offset, &lp3943->pin_used))
> > +		if (test_and_set_bit(offset, &lp3943->pin_used)) {
> > +			kfree(pwm_map);
> >  			return ERR_PTR(-EBUSY);
> > +		}
> >  	}
> >  
> >  	return pwm_map;
> 
> Lee, since you took this driver via the MFD tree, would you mind picking
> up this fix as well?

Everything I have is now in Mainline.

It's best for you to apply it now I think?

> In case you don't have it in your inbox somewhere, you should be able to
> grab it from here:
> 
> 	http://patchwork.ozlabs.org/patch/313741/
> 
> In that case:
> 
> Acked-by: Thierry Reding <thierry.reding@gmail.com>
> 
> Thierry



-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2014-01-27  9:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-23 21:32 [PATCH] pwm: lp3943: Fix potential memory leak during request Christian Engelmayer
2014-01-23 22:47 ` Milo Kim
2014-01-24 16:23 ` Thierry Reding
2014-01-27  9:58   ` Lee Jones [this message]
2014-01-27 12:51     ` Thierry Reding
2014-02-26 15:09 ` Thierry Reding

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=20140127095803.GC14478@lee--X1 \
    --to=lee.jones@linaro.org \
    --cc=cengelma@gmx.at \
    --cc=linux-pwm@vger.kernel.org \
    --cc=milo.kim@ti.com \
    --cc=thierry.reding@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox