]> git.baikalelectronics.ru Git - kernel.git/commit
rtc: fix RTC removal
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Sat, 5 Dec 2020 23:14:48 +0000 (00:14 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Tue, 15 Dec 2020 23:33:33 +0000 (00:33 +0100)
commit38ba89a6fc279eea8a561c84c6d5e55811b48104
tree7c32ee1f3517ddad58b76c9b854f76fc9fb8a59b
parentc40154e1148eefb0b1292be11d6e68bff0025848
rtc: fix RTC removal

Since the rtc_register_device, removing an RTC device will end with a
refcount_t: underflow; use-after-free warning since put_device is called
twice in the device tear down path.

Fixes: 3219ffa7e94f ("rtc: rework rtc_register_device() resource management")
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Link: https://lore.kernel.org/r/20201205231449.610980-1-alexandre.belloni@bootlin.com
drivers/rtc/class.c