public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2005@gmx.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Greg KH <greg@kroah.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	stable@kernel.org, acpi-devel <acpi-devel@lists.sourceforge.net>
Subject: [PATCH] Fix oops in asus_acpi.c on Samsung P30/P35 Laptops
Date: Wed, 14 Dec 2005 05:48:54 +0100	[thread overview]
Message-ID: <439FA436.50107@gmx.net> (raw)
In-Reply-To: <439A23CB.50102@gmx.net>

Linus, Greg,

please apply the following patch to your trees. It fixes
http://bugzilla.kernel.org/show_bug.cgi?id=5067

The patch has been tested and verified, is shipped in the
SUSE 10.0 kernel and does not cause any regressions.

Unfortunately, the ACPI maintainers have been ignoring
this patch for the last few months despite repeated
requests for review on acpi-devel. I even CCed all ACPI
maintainers personally and didn't receive any response.

Regards,
Carl-Daniel


From: Christian Aichinger <Greek0@gmx.net>
Subject: [PATCH] acpi: Fix oops in asus_acpi.c on Samsung P30/P35 Laptops
Date: 2005-09-23 23:36:25 GMT

Samsung P35's INIT returns an integer (instead of a string or a
plain buffer), which caused an oops when the result was treated as
string in asus_hotk_get_info() (since an invalid pointer got
dereferenced).

This patch explicitly checks for ACPI_TYPE_INTEGER and for the
return values possible on the P30/P35.

Signed-off-by: Christian Aichinger <Greek0@gmx.net>

    drivers/acpi/asus_acpi.c |   31 ++++++++++++++++++++++++++++---
    1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -1006,6 +1006,24 @@ static int __init asus_hotk_get_info(voi
  	}

  	model = (union acpi_object *)buffer.pointer;
+
+	/* INIT on Samsung's P35 returns an integer, possible return
+	 * values are tested below */
+	if (model->type == ACPI_TYPE_INTEGER) {
+		if (model->integer.value == -1 ||
+			model->integer.value == 0x58 ||
+			model->integer.value == 0x38) {
+			hotk->model = P30;
+			printk(KERN_NOTICE
+				       "  Samsung P35 detected, supported\n");
+			goto out_known;
+		} else {
+			printk(KERN_WARNING
+				"  unknown integer returned by INIT\n");
+			goto out_unknown;
+		}
+	}
+
  	if (model->type == ACPI_TYPE_STRING) {
  		printk(KERN_NOTICE "  %s model detected, ",
  		       model->string.pointer);
@@ -1057,9 +1075,7 @@ static int __init asus_hotk_get_info(voi
  		hotk->model = L5x;

  	if (hotk->model == END_MODEL) {
-		printk("unsupported, trying default values, supply the "
-		       "developers with your DSDT\n");
-		hotk->model = M2E;
+		goto out_unknown;
  	} else {
  		printk("supported\n");
  	}
@@ -1088,6 +1104,15 @@ static int __init asus_hotk_get_info(voi
  	acpi_os_free(model);

  	return AE_OK;
+
+out_unknown:
+	printk(KERN_WARNING "  unsupported, trying default values, "
+			"supply the developers with your DSDT\n");
+	hotk->model = M2E;
+out_known:
+	hotk->methods = &model_conf[hotk->model];
+	acpi_os_free(model);
+	return AE_OK;
  }

  static int __init asus_hotk_check(void)


  reply	other threads:[~2005-12-14  4:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-06 18:32 [PATCH] Fix oops in asus_acpi.c on Samsung P30/P35 Laptops Carl-Daniel Hailfinger
2005-12-06 19:21 ` [stable] " Greg KH
2005-12-06 20:12   ` Carl-Daniel Hailfinger
2005-12-08  3:38     ` Greg KH
2005-12-10  0:39       ` Carl-Daniel Hailfinger
2005-12-14  4:48         ` Carl-Daniel Hailfinger [this message]
2005-12-14  4:58           ` Greg KH
2005-12-14  5:15           ` Linus Torvalds
2005-12-14  5:16           ` Andrew Morton

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=439FA436.50107@gmx.net \
    --to=c-d.hailfinger.devel.2005@gmx.net \
    --cc=acpi-devel@lists.sourceforge.net \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@osdl.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