]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
drivers: watchdog: rdc321x_wdt: Fix race condition bugs
authorMadhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
Fri, 7 Aug 2020 11:29:02 +0000 (16:59 +0530)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Wed, 14 Oct 2020 13:02:21 +0000 (15:02 +0200)
commit4b2e7f99cdd314263c9d172bc17193b8b6bba463
treee6c4a60c323581fa36a9a68cee62ef2ebf1b93e7
parenta1b8638ba1320e6684aa98233c15255eb803fac7
drivers: watchdog: rdc321x_wdt: Fix race condition bugs

In rdc321x_wdt_probe(), rdc321x_wdt_device.queue is initialized
after misc_register(), hence if ioctl is called before its
initialization which can call rdc321x_wdt_start() function,
it will see an uninitialized value of rdc321x_wdt_device.queue,
hence initialize it before misc_register().
Also, rdc321x_wdt_device.default_ticks is accessed in reset()
function called from write callback, thus initialize it before
misc_register().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20200807112902.28764-1-madhuparnabhowmik10@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/watchdog/rdc321x_wdt.c