]> git.baikalelectronics.ru Git - kernel.git/commit
gpiolib: cdev: fix minor race in GET_LINEINFO_WATCH
authorKent Gibson <warthog618@gmail.com>
Wed, 8 Jul 2020 04:15:53 +0000 (12:15 +0800)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Sun, 12 Jul 2020 08:22:01 +0000 (10:22 +0200)
commitdce9e8c363b9665e0f2b71cc9470157c6ed606bb
treeaa8a58adb18e33acaab8db518e5fb4ec6030e448
parent9a4d710e8d12488e6ad978fa73253e30884c841b
gpiolib: cdev: fix minor race in GET_LINEINFO_WATCH

Merge separate usage of test_bit/set_bit into test_and_set_bit to remove
the possibility of a race between the test and set.

Similarly test_bit and clear_bit.

In the existing code it is possible for two threads to race past the
test_bit and then set or clear the watch bit, and neither return EBUSY.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
drivers/gpio/gpiolib-cdev.c