public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: Rajan Aggarwal <rajan.aggarwal85@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] Free fw_priv in fw_create_instance
Date: Tue, 30 Aug 2011 12:19:37 -0700	[thread overview]
Message-ID: <20110830191937.GA8689@suse.de> (raw)
In-Reply-To: <1314731192-1960-1-git-send-email-rajan.aggarwal85@gmail.com>

On Wed, Aug 31, 2011 at 12:36:32AM +0530, Rajan Aggarwal wrote:
> fw_priv is not being freed in some of the error scenarios in
> fw_create_instance.

Not true.

> This patch makes sure that this is kfreed properly in all error
> situations in the fw_create_instance logic where it is required.

Nope, this will cause a double-free to happen.

> Signed-off-by: Rajan Aggarwal <rajan.aggarwal85@gmail.com>
> ---
>  drivers/base/firmware_class.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> index 06ed6b4..3ddbc48 100644
> --- a/drivers/base/firmware_class.c
> +++ b/drivers/base/firmware_class.c
> @@ -497,6 +497,7 @@ err_del_dev:
>  	device_del(f_dev);
>  err_put_dev:
>  	put_device(f_dev);
> +	kfree(fw_priv);

Did you test this patch out?  What happened when you tested it?

How did you find this "problem"?

Care to look a bit closer at the code?

I'd give you a hint, but it's more sporting this way :)

thanks,

greg k-h

  reply	other threads:[~2011-08-30 19:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-30 19:06 [PATCH 1/1] Free fw_priv in fw_create_instance Rajan Aggarwal
2011-08-30 19:19 ` Greg KH [this message]
2011-08-30 19:46   ` Rajan Aggarwal
2011-08-30 21:26     ` 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=20110830191937.GA8689@suse.de \
    --to=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rajan.aggarwal85@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