From: Pavel Machek <pavel@suse.cz>
To: vojtech@suse.cz, kernel list <linux-kernel@vger.kernel.org>
Subject: insunficient locking in input.c (?)
Date: Fri, 28 Nov 2003 16:37:28 +0100 [thread overview]
Message-ID: <20031128153727.GA194@elf.ucw.cz> (raw)
Hi!
It seems to me some more locking is needed:
1) input_event() seems to be called from both keyboard interupt and
from timer. That makes it pretty nasty beast.
It does:
...
list_for_each_entry(handle, &dev->h_list, d_node)
if (handle->open)
handle->handler->event(handle, type, code, value);
...
while input_unregister_handler could be running (on other CPU?)
void input_unregister_handler(struct input_handler *handler)
{
struct list_head * node, * next;
list_for_each_safe(node, next, &handler->h_list) {
struct input_handle * handle = to_handle_h(node);
list_del_init(&handle->h_node);
list_del_init(&handle->d_node);
handler->disconnect(handle);
}
I guess that some locking around these lists is needed.
2) input_event() is called from both keyboard interupt and from
timer. That makes it behave pretty badly w.r.t. low-level handlers. I
think that you can have one low-level handler running two times
concurrently.
There's no locking preventing that. AFAICS autorepeat timer can tick
once more after key is released, which is normally not a problem, but
if key is pressed while that, it looks to me like there can be normal
key down and autorepeat entering input_event() concurrently, which
then calls low-level handler (for example kbd_keycode)
concurrently. kbd_keycode() certainly is not written to handle _that_.
Pavel
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
reply other threads:[~2003-11-28 15:54 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=20031128153727.GA194@elf.ucw.cz \
--to=pavel@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=vojtech@suse.cz \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox