linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 1/4] iio:kfifo: Fix memory leak
Date: Tue, 15 Oct 2013 19:19:17 +0100	[thread overview]
Message-ID: <525D8725.9060706@kernel.org> (raw)
In-Reply-To: <1381825830-25581-1-git-send-email-lars@metafoo.de>

On 10/15/13 09:30, Lars-Peter Clausen wrote:
> We need to free the kfifo when we release the buffer, otherwise the fifos memory
> will be leaked.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Applied to the togreg branch.
> 
> ---
> New in v2
> 
> Btw. This is all against togreg, since it is probably already to late for
> fixes-togreg.
Indeed, probably is.

We should work out which of these we want stable to pick up at somepoint though...

> ---
>  drivers/iio/kfifo_buf.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/kfifo_buf.c b/drivers/iio/kfifo_buf.c
> index b4ac55a..ce51092 100644
> --- a/drivers/iio/kfifo_buf.c
> +++ b/drivers/iio/kfifo_buf.c
> @@ -132,7 +132,10 @@ static int iio_read_first_n_kfifo(struct iio_buffer *r,
>  
>  static void iio_kfifo_buffer_release(struct iio_buffer *buffer)
>  {
> -	kfree(iio_to_kfifo(buffer));
> +	struct iio_kfifo *kf = iio_to_kfifo(buffer);
> +
> +	kfifo_free(&kf->kf);
> +	kfree(kf);
>  }
>  
>  static const struct iio_buffer_access_funcs kfifo_access_funcs = {
> 

      parent reply	other threads:[~2013-10-15 17:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-15  8:30 [PATCH v2 1/4] iio:kfifo: Fix memory leak Lars-Peter Clausen
2013-10-15  8:30 ` [PATCH v2 2/4] iio:kfifo: Protect against concurrent access from userspace Lars-Peter Clausen
2013-10-15 18:19   ` Jonathan Cameron
2013-10-15  8:30 ` [PATCH v2 3/4] iio:kfifo: Empty buffer on update Lars-Peter Clausen
2013-10-15 18:20   ` Jonathan Cameron
2013-10-15  8:30 ` [PATCH v2 4/4] iio:kfifo: Set update_needed to false after allocating a new buffer Lars-Peter Clausen
2013-10-15 18:20   ` Jonathan Cameron
2013-10-15 18:19 ` Jonathan Cameron [this message]

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=525D8725.9060706@kernel.org \
    --to=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).