watchdog_dev is not smp safe?!
Hi,
While working on converting my sch56xx watchdog driver to watchdog_dev, I noticed that watchdog_dev.c does not do any locking.
At a first look this may seem ok, since only 1 open is allowed, but a process with /dev/watchdog open could use threads or fork and that way still make multiple write / ioctl calls at the same time.
This causes 2 potential problems:
1) watchdog_start / open do an unlocked test_n_set / test_n_clear, if these 2 race, the watchdog could be stopped while the active bit indicates it is running or visa versa.
2) Most watchdog_dev drivers probably assume that only one watchdog-op will get called at a time, this is not necessary true atm
Notice that 2. is fixed by my "watchdog_dev: Add support for dynamically allocated watchdog_device structs" patch which is still pending review.
Changing that patch to also fix 1. is quite easy. But before I put more work into that patch I would first like some feedback on it ...
Regards,
Hans