* [RFC] enhanced psxface.c error handling
@ 2003-12-04 16:02 Felipe Alfaro Solana
2003-12-04 16:14 ` Mihai RUSU
0 siblings, 1 reply; 3+ messages in thread
From: Felipe Alfaro Solana @ 2003-12-04 16:02 UTC (permalink / raw)
To: acpi-devel; +Cc: Linux Kernel Mailinglist
[-- Attachment #1: Type: text/plain, Size: 168 bytes --]
Hi!
This patch tries to fix the situation where an error could cause
acpi_psx_execute() to exit without releasing held references to the
elements of param[].
Thanks!
[-- Attachment #2: acpi.patch --]
[-- Type: text/x-patch, Size: 2599 bytes --]
diff -uNr linux-2.6.0-test11.orig/drivers/acpi/parser/psxface.c linux-2.6.0-test11/drivers/acpi/parser/psxface.c
--- linux-2.6.0-test11.orig/drivers/acpi/parser/psxface.c 2003-11-26 21:45:20.000000000 +0100
+++ linux-2.6.0-test11/drivers/acpi/parser/psxface.c 2003-12-01 09:23:18.591462114 +0100
@@ -127,7 +127,8 @@
op = acpi_ps_create_scope_op ();
if (!op) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ status = AE_NO_MEMORY;
+ goto acpi_psx_parse_unref;
}
/*
@@ -142,14 +143,15 @@
walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
NULL, NULL, NULL);
if (!walk_state) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ goto acpi_psx_parse_unref;
+ status = AE_NO_MEMORY;
}
status = acpi_ds_init_aml_walk (walk_state, op, method_node, obj_desc->method.aml_start,
obj_desc->method.aml_length, NULL, NULL, 1);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
- return_ACPI_STATUS (status);
+ goto acpi_psx_parse_unref;
}
/* Parse the AML */
@@ -168,7 +170,8 @@
op = acpi_ps_create_scope_op ();
if (!op) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ status = AE_NO_MEMORY;
+ goto acpi_psx_parse_unref;
}
/* Init new op with the method name and pointer back to the NS node */
@@ -180,14 +183,15 @@
walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
if (!walk_state) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ status = AE_NO_MEMORY;
+ goto acpi_psx_parse_unref;
}
status = acpi_ds_init_aml_walk (walk_state, op, method_node, obj_desc->method.aml_start,
obj_desc->method.aml_length, params, return_obj_desc, 3);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
- return_ACPI_STATUS (status);
+ goto acpi_psx_parse_unref;
}
/*
@@ -196,16 +200,6 @@
status = acpi_ps_parse_aml (walk_state);
acpi_ps_delete_parse_tree (op);
- if (params) {
- /* Take away the extra reference that we gave the parameters above */
-
- for (i = 0; params[i]; i++) {
- /* Ignore errors, just do them all */
-
- (void) acpi_ut_update_object_reference (params[i], REF_DECREMENT);
- }
- }
-
/*
* If the method has returned an object, signal this to the caller with
* a control exception code
@@ -218,6 +212,18 @@
status = AE_CTRL_RETURN_VALUE;
}
+acpi_psx_parse_unref:
+
+ if (params) {
+ /* Take away the extra reference that we gave the parameters above */
+
+ for (i = 0; params[i]; i++) {
+ /* Ignore errors, just do them all */
+
+ (void) acpi_ut_update_object_reference (params[i], REF_DECREMENT);
+ }
+ }
+
return_ACPI_STATUS (status);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] enhanced psxface.c error handling
2003-12-04 16:02 [RFC] enhanced psxface.c error handling Felipe Alfaro Solana
@ 2003-12-04 16:14 ` Mihai RUSU
2003-12-04 22:00 ` Felipe Alfaro Solana
0 siblings, 1 reply; 3+ messages in thread
From: Mihai RUSU @ 2003-12-04 16:14 UTC (permalink / raw)
To: Felipe Alfaro Solana; +Cc: acpi-devel, Linux Kernel Mailinglist
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi
I think you missed the order on this one
@@ -142,14 +143,15 @@
walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
NULL, NULL, NULL);
if (!walk_state) {
- - return_ACPI_STATUS (AE_NO_MEMORY);
+ goto acpi_psx_parse_unref;
+ status = AE_NO_MEMORY;
}
:)
On Thu, 4 Dec 2003, Felipe Alfaro Solana wrote:
> Hi!
>
> This patch tries to fix the situation where an error could cause
> acpi_psx_execute() to exit without releasing held references to the
> elements of param[].
>
> Thanks!
>
- --
Mihai RUSU Email: dizzy@roedu.net
GPG : http://dizzy.roedu.net/dizzy-gpg.txt WWW: http://dizzy.roedu.net
"Linux is obsolete" -- AST
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/z11QPZzOzrZY/1QRAriPAJ9tJ9A+l1VVCkvxVp5xKcl29+vnBwCguemq
B4+AFaGmaYPah7YgNObfbk4=
=6Nay
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] enhanced psxface.c error handling
2003-12-04 16:14 ` Mihai RUSU
@ 2003-12-04 22:00 ` Felipe Alfaro Solana
0 siblings, 0 replies; 3+ messages in thread
From: Felipe Alfaro Solana @ 2003-12-04 22:00 UTC (permalink / raw)
To: acpi-devel; +Cc: Linux Kernel Mailinglist
[-- Attachment #1: Type: text/plain, Size: 121 bytes --]
On Thu, 2003-12-04 at 17:14, Mihai RUSU wrote:
> I think you missed the order on this one
Yep! You're right... thanks!
[-- Attachment #2: acpi.patch --]
[-- Type: text/x-patch, Size: 2599 bytes --]
diff -uNr linux-2.6.0-test11.orig/drivers/acpi/parser/psxface.c linux-2.6.0-test11/drivers/acpi/parser/psxface.c
--- linux-2.6.0-test11.orig/drivers/acpi/parser/psxface.c 2003-11-26 21:45:20.000000000 +0100
+++ linux-2.6.0-test11/drivers/acpi/parser/psxface.c 2003-12-01 09:23:18.591462114 +0100
@@ -127,7 +127,8 @@
op = acpi_ps_create_scope_op ();
if (!op) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ status = AE_NO_MEMORY;
+ goto acpi_psx_parse_unref;
}
/*
@@ -142,14 +143,15 @@
walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,
NULL, NULL, NULL);
if (!walk_state) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ status = AE_NO_MEMORY;
+ goto acpi_psx_parse_unref;
}
status = acpi_ds_init_aml_walk (walk_state, op, method_node, obj_desc->method.aml_start,
obj_desc->method.aml_length, NULL, NULL, 1);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
- return_ACPI_STATUS (status);
+ goto acpi_psx_parse_unref;
}
/* Parse the AML */
@@ -168,7 +170,8 @@
op = acpi_ps_create_scope_op ();
if (!op) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ status = AE_NO_MEMORY;
+ goto acpi_psx_parse_unref;
}
/* Init new op with the method name and pointer back to the NS node */
@@ -180,14 +183,15 @@
walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
if (!walk_state) {
- return_ACPI_STATUS (AE_NO_MEMORY);
+ status = AE_NO_MEMORY;
+ goto acpi_psx_parse_unref;
}
status = acpi_ds_init_aml_walk (walk_state, op, method_node, obj_desc->method.aml_start,
obj_desc->method.aml_length, params, return_obj_desc, 3);
if (ACPI_FAILURE (status)) {
acpi_ds_delete_walk_state (walk_state);
- return_ACPI_STATUS (status);
+ goto acpi_psx_parse_unref;
}
/*
@@ -196,16 +200,6 @@
status = acpi_ps_parse_aml (walk_state);
acpi_ps_delete_parse_tree (op);
- if (params) {
- /* Take away the extra reference that we gave the parameters above */
-
- for (i = 0; params[i]; i++) {
- /* Ignore errors, just do them all */
-
- (void) acpi_ut_update_object_reference (params[i], REF_DECREMENT);
- }
- }
-
/*
* If the method has returned an object, signal this to the caller with
* a control exception code
@@ -218,6 +212,18 @@
status = AE_CTRL_RETURN_VALUE;
}
+acpi_psx_parse_unref:
+
+ if (params) {
+ /* Take away the extra reference that we gave the parameters above */
+
+ for (i = 0; params[i]; i++) {
+ /* Ignore errors, just do them all */
+
+ (void) acpi_ut_update_object_reference (params[i], REF_DECREMENT);
+ }
+ }
+
return_ACPI_STATUS (status);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-12-04 22:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-04 16:02 [RFC] enhanced psxface.c error handling Felipe Alfaro Solana
2003-12-04 16:14 ` Mihai RUSU
2003-12-04 22:00 ` Felipe Alfaro Solana
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).