]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
regulator: core: fix race condition in regulator_put()
authorAshay Jaiswal <ashayj@codeaurora.org>
Thu, 8 Jan 2015 13:24:25 +0000 (18:54 +0530)
committerJiri Slaby <jslaby@suse.cz>
Sun, 8 Feb 2015 19:02:03 +0000 (20:02 +0100)
commit28140574e151bbdbd34f28be4e656ea6b1b5ae9d
tree20f042067bbf93109ffaf80d52b2651400e924e4
parent7d2e24600d926215b262b4de111c298c14b9c3cd
regulator: core: fix race condition in regulator_put()

commit 83b0302d347a49f951e904184afe57ac3723476e upstream.

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.

In the case of regulator_put() the consumer is removed and regulator
device's parameters are updated without holding the regulator device's
mutex. This would lead to a race condition between the regulator_put()
and any function which traverses the consumer list or modifies regulator
device's parameters.
Fix this race condition by holding the regulator device's mutex in case
of regulator_put.

Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/regulator/core.c