[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e6a7af86-42e6-83b8-4b3d-4be2812912b5@roeck-us.net>
Date: Mon, 7 May 2018 20:42:04 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Jia-Ju Bai <baijiaju1990@...il.com>, morbidrsa@...il.com,
wim@...ux-watchdog.org
Cc: linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] watchdog: mena21_wdt: Fix a possible data race in
a21_wdt_set_timeout
On 05/07/2018 08:32 PM, Jia-Ju Bai wrote:
>
>
> On 2018/5/8 11:28, Guenter Roeck wrote:
>> On 05/07/2018 08:18 PM, Jia-Ju Bai wrote:
>>> The write operation to "wdt->timeout" is protected by
>>> the lock on line 118, but the read operation to
>>> this data on line 105 is not protected by the lock.
>>> Thus, there may exist a data race for "wdt->timeout".
>>>
>>> To fix this data race, the read operation to "wdt->timeout"
>>> should be also protected by the lock.
>>>
>>
>> There is no race. There is already a mutex in the watchdog core which serializes
>> calls to the various API functions. It would make more sense to drop drv->lock
>> from the driver.
>>
>
> Thanks for your reply :)
> Need I submit a patch of dropping all calls to "drv->lock"?
>
You don't _need_ to, but I would happily give it my Reviewed-by: tag if you do.
Guenter
Powered by blists - more mailing lists