Comment 14 for bug 1093543

Revision history for this message
bwalex (ahornung) wrote :

The issue here is a bug in the bq27541 fuel gauge driver. The get_property() function is not thread-safe, but reentry is possible in several different scenarios.

The attached patch fixes this issue by protecting get_property() via a mutex.

Below is the patch commit message, for clarity:

 * Currently, get_property() and its callees are not thread-safe, since
   they share some global state, which they access without serialization
   or guaranteed atomicity.

 * get_property() can be called in a reentrant fashion from either
   several concurrent sysfs accesses, or a sysfs access concurrently with
   an access from power_supply_core.c, which in turn are triggered from
   a work queue in the driver itself.

 * This fixes bogus readings affecting the capacity and the charge_now
   values - possibly others as well.