From: Hans de Goede <hdegoede@redhat.com>
To: linux-watchdog@vger.kernel.org
Subject: watchdog_dev is not smp safe?!
Date: Mon, 09 Apr 2012 15:04:44 +0200 [thread overview]
Message-ID: <4F82DE6C.3070803@redhat.com> (raw)
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
reply other threads:[~2012-04-09 13:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F82DE6C.3070803@redhat.com \
--to=hdegoede@redhat.com \
--cc=linux-watchdog@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.