[ldv-project] [PATCH] drivers: watchdog: rdc321x_wdt: Fix race condition bugs

Guenter Roeck linux at roeck-us.net
Fri Aug 7 22:00:56 MSK 2020


On 8/7/20 11:30 AM, Evgeny Novikov wrote:
> 07.08.2020, 19:21, "Guenter Roeck" <linux at roeck-us.net>:
>> On Fri, Aug 07, 2020 at 04:59:02PM +0530, madhuparnabhowmik10 at gmail.com wrote:
>>>  From: Madhuparna Bhowmik <madhuparnabhowmik10 at gmail.com>
>>>
>>>  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 at gmail.com>
>>
>> Reviewed-by: Guenter Roeck <linux at roeck-us.net>
>>
>> Having said that ... this is yet another potentially obsolete driver.
>> You are really wasting your (and, fwiw, my) time.
> 
> Static analysis tools are not aware about obsolete drivers.
> It would be great if there will be some formal way to filter them out.
> Maybe some file will enumerate all obsolete drivers, or there will be
> something within their source code, or something else.
> 

In general, all watchdog drivers not implementing the watchdog API
are effectively obsolete and should not be touched. If they are still
in use (meaning someone has a means to test them), they should be
converted to use the watchdog API instead.

Guenter



More information about the ldv-project mailing list