linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
To: mjg@redhat.com
Cc: marcel@holtmann.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org,
	Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Subject: [PATCH 1/5] dell-laptop: fix a use-after-free error on the failure path
Date: Wed, 19 Aug 2009 15:06:47 +0100	[thread overview]
Message-ID: <1250690811-21203-1-git-send-email-alan-jenkins@tuffmail.co.uk> (raw)
In-Reply-To: <4A8C0623.8030808@tuffmail.co.uk>

dell_setup_rfkill() already cleans up the rfkill devices on failure.
So if it returns an error, we should not try to unregister the rfkill
devices.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
---
 drivers/platform/x86/dell-laptop.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index 74909c4..12b6f33 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -330,7 +330,7 @@ static int __init dell_init(void)
 
 	if (ret) {
 		printk(KERN_WARNING "dell-laptop: Unable to setup rfkill\n");
-		goto out;
+		goto fail_rfkill;
 	}
 
 #ifdef CONFIG_ACPI
@@ -358,7 +358,7 @@ static int __init dell_init(void)
 		if (IS_ERR(dell_backlight_device)) {
 			ret = PTR_ERR(dell_backlight_device);
 			dell_backlight_device = NULL;
-			goto out;
+			goto fail_backlight;
 		}
 
 		dell_backlight_device->props.max_brightness = max_intensity;
@@ -368,13 +368,15 @@ static int __init dell_init(void)
 	}
 
 	return 0;
-out:
+
+fail_backlight:
 	if (wifi_rfkill)
 		rfkill_unregister(wifi_rfkill);
 	if (bluetooth_rfkill)
 		rfkill_unregister(bluetooth_rfkill);
 	if (wwan_rfkill)
 		rfkill_unregister(wwan_rfkill);
+fail_rfkill:
 	kfree(da_tokens);
 	return ret;
 }
-- 
1.6.3.2


  reply	other threads:[~2009-08-19 14:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-19 14:03 [PATCH 0/5] dell-laptop improvements Alan Jenkins
2009-08-19 14:06 ` Alan Jenkins [this message]
2009-12-10  5:00   ` [PATCH 1/5] dell-laptop: fix a use-after-free error on the failure path Len Brown
2009-08-19 14:06 ` [PATCH 2/5] dell-laptop: fix rfkill memory leak on unload and failure paths Alan Jenkins
2009-12-10  5:01   ` Len Brown
2009-08-19 14:06 ` [PATCH 3/5] dell-laptop: create a platform device as a parent for the rfkill devices etc Alan Jenkins
2009-08-19 14:06 ` [PATCH 4/5] dell-laptop: add __init to init functions Alan Jenkins
2009-12-10  5:02   ` Len Brown
2009-08-19 14:06 ` [PATCH 5/5] dell-laptop: poll the rfkill hard-block Alan Jenkins
2009-08-19 14:13   ` Matthew Garrett
2009-08-19 14:44     ` [PATCH 6/5] dell-laptop: remove duplicate Kconfig entry under drivers/misc Alan Jenkins
2009-12-10  5:03       ` Len Brown
2009-08-19 14:09 ` [PATCH 0/5] dell-laptop improvements Matthew Garrett

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=1250690811-21203-1-git-send-email-alan-jenkins@tuffmail.co.uk \
    --to=alan-jenkins@tuffmail.co.uk \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=mjg@redhat.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;
as well as URLs for NNTP newsgroup(s).