ACPI: EC: Reference count query handlers under lock
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 27 Dec 2019 10:04:21 +0000 (11:04 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 27 Dec 2019 10:04:21 +0000 (11:04 +0100)
commit3df663a147fe077a6ee8444ec626738946e65547
tree1059c7bd9be1c08fa5ffc7d058613c47de7df0c7
parent46cf053efec6a3a5f343fead837777efe8252a46
ACPI: EC: Reference count query handlers under lock

There is a race condition in acpi_ec_get_query_handler()
theoretically allowing query handlers to go away before refernce
counting them.

In order to avoid it, call kref_get() on query handlers under
ec->mutex.

Also simplify the code a bit while at it.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/ec.c