Re: [PATCH v2] regulator: core: fix race condition in regulator_put()

From: Mark Brown
Date: Thu Jan 08 2015 - 13:16:07 EST


On Thu, Jan 08, 2015 at 06:54:25PM +0530, Ashay Jaiswal wrote:
> The regulator framework maintains a list of consumer regulators
> for a regulator device and protects it from concurrent access using
> the regulator device's mutex lock.

Applied, thanks but...

> + mutex_lock(&rdev->mutex);
> kfree(regulator->supply_name);
> list_del(&regulator->list);
> kfree(regulator);
>
> rdev->open_count--;
> rdev->exclusive = 0;
> + mutex_unlock(&rdev->mutex);

I'll do a followup which moves the frees out of the locked region
(reordering things a bit) - they're the main bit I was worried about
with time, they should be fast since they're just frees but it's easy
enough to avoid having to think about it.

Attachment: signature.asc
Description: Digital signature