diff options
author | Jon Hunter <jonathanh@nvidia.com> | 2016-02-11 18:03:21 +0000 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2016-04-05 15:22:45 +0200 |
commit | e8cf6616a346029fe3e3931dd34fc589fade4b6e (patch) | |
tree | 0be012e6dd45682b80250d4589b0785a508729c2 /include/soc | |
parent | 0259f522e04f19b433a4dc7586d80da106afbbcc (diff) | |
download | linux-e8cf6616a346029fe3e3931dd34fc589fade4b6e.tar.bz2 |
soc/tegra: pmc: Protect public functions from potential race conditions
The PMC base address pointer is initialised during early boot so that
early platform code may used the PMC public functions. During the probe
of the PMC driver the base address pointer is mapped again and the initial
mapping is freed. This exposes a window where a device accessing the PMC
registers via one of the public functions, could race with the updating
of the pointer and lead to a invalid access. Furthermore, the only
protection between multiple devices attempting to access the PMC registers
is when setting the powergate state to on or off. None of the other public
functions that access the PMC registers are protected.
Use the existing mutex to protect paths that may race with regard to
accessing the PMC registers.
Note that functions tegra_io_rail_prepare()/poll() either return a
negative value on failure or zero on success. Therefore, it is not
necessary to check if the return value is less than zero and so only
test that the return value is not zero to test for failure. This
simplifies the error handling with the mutex locking in place.
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'include/soc')
0 files changed, 0 insertions, 0 deletions