X86 platform drivers
 help / color / mirror / Atom feed
From: Carlos Corbacho <carlos@strangeworlds.co.uk>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>, platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 02/10] WMI: free wmi blocks when parse_wdg() fails
Date: Sun, 12 Sep 2010 18:19:40 +0100	[thread overview]
Message-ID: <201009121819.40762.carlos@strangeworlds.co.uk> (raw)
In-Reply-To: <20100826071447.7976.15612.stgit@localhost.localdomain>

On Thursday 26 August 2010 08:14:48 Dmitry Torokhov wrote:
> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

Acked-by: Carlos Corbacho <carlos@strangeworlds.co.uk>

> ---
> 
>  drivers/platform/x86/wmi.c |   25 +++++++++++++++----------
>  1 files changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> index 7a77f03..030d5f2 100644
> --- a/drivers/platform/x86/wmi.c
> +++ b/drivers/platform/x86/wmi.c
> @@ -807,6 +807,16 @@ static bool guid_already_parsed(const char
> *guid_string) return false;
>  }
> 
> +static void free_wmi_blocks(void)
> +{
> +	struct wmi_block *wblock, *next;
> +
> +	list_for_each_entry_safe(wblock, next, &wmi_blocks.list, list) {
> +		list_del(&wblock->list);
> +		kfree(wblock);
> +	}
> +}
> +
>  /*
>   * Parse the _WDG method for the GUID data blocks
>   */
> @@ -865,7 +875,7 @@ static acpi_status parse_wdg(acpi_handle handle)
>  		wblock->handle = handle;
>  		if (debug_event) {
>  			wblock->handler = wmi_notify_debug;
> -			status = wmi_method_enable(wblock, 1);
> +			wmi_method_enable(wblock, 1);
>  		}
>  		list_add_tail(&wblock->list, &wmi_blocks.list);
>  	}
> @@ -875,6 +885,9 @@ out_free_gblock:
>  out_free_pointer:
>  	kfree(out.pointer);
> 
> +	if (ACPI_FAILURE(status))
> +		free_wmi_blocks();
> +
>  	return status;
>  }
> 
> @@ -1014,19 +1027,11 @@ static int __init acpi_wmi_init(void)
> 
>  static void __exit acpi_wmi_exit(void)
>  {
> -	struct list_head *p, *tmp;
> -	struct wmi_block *wblock;
> -
>  	wmi_class_exit();
> 
>  	acpi_bus_unregister_driver(&acpi_wmi_driver);
> 
> -	list_for_each_safe(p, tmp, &wmi_blocks.list) {
> -		wblock = list_entry(p, struct wmi_block, list);
> -
> -		list_del(p);
> -		kfree(wblock);
> -	}
> +	free_wmi_blocks();
> 
>  	printk(KERN_INFO PREFIX "Mapper unloaded\n");
>  }

-- 
E-Mail: carlos@strangeworlds.co.uk
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D

  reply	other threads:[~2010-09-12 17:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-26  7:14 [PATCH 01/10] WMI: remove EC region handler when _WDG parsing fails Dmitry Torokhov
2010-08-26  7:14 ` [PATCH 02/10] WMI: free wmi blocks when parse_wdg() fails Dmitry Torokhov
2010-09-12 17:19   ` Carlos Corbacho [this message]
2010-08-26  7:14 ` [PATCH 03/10] WMI: fix wmi_gtoa() to actully terminate the string Dmitry Torokhov
2010-09-12 17:28   ` Carlos Corbacho
2010-08-26  7:14 ` [PATCH 04/10] WMI: do not leak memory in parse_wdg() Dmitry Torokhov
2010-09-12 17:29   ` Carlos Corbacho
2010-08-26  7:15 ` [PATCH 05/10] WMI: fix potential NULL pointer dereference Dmitry Torokhov
2010-09-12 17:30   ` Carlos Corbacho
2010-08-26  7:15 ` [PATCH 06/10] WMI: simplify handling of returned WMI blocks in parse_wdg() Dmitry Torokhov
2010-09-12 17:39   ` Carlos Corbacho
2010-08-26  7:15 ` [PATCH 07/10] WMI: use separate list head for storing wmi blocks Dmitry Torokhov
2010-09-12 17:40   ` Carlos Corbacho
2010-08-26  7:15 ` [PATCH 08/10] WMI: use pr_err() and friends Dmitry Torokhov
2010-09-12 17:42   ` Carlos Corbacho
2010-08-26  7:15 ` [PATCH 09/10] WMI: make use of class device's attributres Dmitry Torokhov
2010-09-12 17:50   ` Carlos Corbacho
2010-08-26  7:15 ` [PATCH 10/10] WMI: embed struct device directly into wmi_block Dmitry Torokhov
2010-09-12  7:29 ` [PATCH 01/10] WMI: remove EC region handler when _WDG parsing fails Dmitry Torokhov
2010-09-12 17:14 ` Carlos Corbacho
2010-10-01 17:00   ` Dmitry Torokhov

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=201009121819.40762.carlos@strangeworlds.co.uk \
    --to=carlos@strangeworlds.co.uk \
    --cc=dmitry.torokhov@gmail.com \
    --cc=mjg@redhat.com \
    --cc=platform-driver-x86@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