diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-01-23 12:01:10 +0100 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-02-12 11:00:31 +0100 |
commit | d83cee3d2bb131c7fca7e19f1e33dc7530fd7083 (patch) | |
tree | dc59f13db90d3fa22c44d0348534bedadc3dce33 /tools/perf/scripts/python/exported-sql-viewer.py | |
parent | 47d8b4c1d868148c8fb51b785a89e58ca2d02c4d (diff) |
gpio: protect the pointer to gpio_chip in gpio_device with SRCU
Ensure we cannot crash if the GPIO device gets unregistered (and the
chip pointer set to NULL) during any of the API calls.
To that end: wait for all users of gdev->chip to exit their read-only
SRCU critical sections in gpiochip_remove().
For brevity: add a guard class which can be instantiated at the top of
every function requiring read-only access to the chip pointer and use it
in all API calls taking a GPIO descriptor as argument. In places where
we only deal with the GPIO device - use regular guard() helpers and
rcu_dereference() for chip access. Do the same in API calls taking a
const pointer to gpio_desc.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions