Linux Watchdog driver development
 help / color / mirror / Atom feed
* watchdog_dev is not smp safe?!
@ 2012-04-09 13:04 Hans de Goede
  0 siblings, 0 replies; only message in thread
From: Hans de Goede @ 2012-04-09 13:04 UTC (permalink / raw)
  To: linux-watchdog

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-04-09 13:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-09 13:04 watchdog_dev is not smp safe?! Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox