linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] acpi/ec.c: Move call to kref_get() to under the mutex_lock(&ec->mutex)
@ 2019-11-25 11:03 kc27041980
  2019-12-16 11:16 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: kc27041980 @ 2019-11-25 11:03 UTC (permalink / raw)
  To: Rafael J . Wysocki, Len Brown; +Cc: linux-acpi, linux-kernel, KC27041980

From: KC27041980 <kc27041980@gmail.com>

Move call to kref_get() to under the mutex_lock(&ec->mutex) as this
will remove any delete race scenarios.

Signed-off-by: KC27041980 <kc27041980@gmail.com>
---
 drivers/acpi/ec.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index da1e5c5..9c1bd57 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1073,8 +1073,12 @@ acpi_ec_get_query_handler_by_value(struct acpi_ec *ec, u8 value)
 			break;
 		}
 	}
+
+	if (found)
+		acpi_ec_get_query_handler(handler);
 	mutex_unlock(&ec->mutex);
-	return found ? acpi_ec_get_query_handler(handler) : NULL;
+
+	return found ? handler : NULL;
 }
 
 static void acpi_ec_query_handler_release(struct kref *kref)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-16 11:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-25 11:03 [PATCH 1/1] acpi/ec.c: Move call to kref_get() to under the mutex_lock(&ec->mutex) kc27041980
2019-12-16 11:16 ` Rafael J. Wysocki

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).