From patchwork Wed Aug 19 14:06:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Jenkins X-Patchwork-Id: 42705 X-Patchwork-Delegate: lenb@kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7JEJ6IY031095 for ; Wed, 19 Aug 2009 14:19:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752662AbZHSORn (ORCPT ); Wed, 19 Aug 2009 10:17:43 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751966AbZHSORd (ORCPT ); Wed, 19 Aug 2009 10:17:33 -0400 Received: from fallback-out2.mxes.net ([216.86.168.191]:49529 "EHLO fallback-in2.mxes.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752513AbZHSORb (ORCPT ); Wed, 19 Aug 2009 10:17:31 -0400 Received: from mxout-08.mxes.net (mxout-08.mxes.net [216.86.168.183]) by fallback-in1.mxes.net (Postfix) with ESMTP id 7B2BD2FD7A7; Wed, 19 Aug 2009 10:08:12 -0400 (EDT) Received: from localhost.localdomain (unknown [86.53.68.233]) by smtp.mxes.net (Postfix) with ESMTPA id 6385C509DC; Wed, 19 Aug 2009 10:07:05 -0400 (EDT) From: Alan Jenkins 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 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 Message-Id: <1250690811-21203-1-git-send-email-alan-jenkins@tuffmail.co.uk> X-Mailer: git-send-email 1.6.3.2 In-Reply-To: <4A8C0623.8030808@tuffmail.co.uk> References: <4A8C0623.8030808@tuffmail.co.uk> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 --- 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; }