mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Yin,Fengwei" <yfw.kernel@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Is this a preempt issue in drivers/input/evdev.c
Date: Sat, 12 May 2007 11:18:45 +0800	[thread overview]
Message-ID: <1178939925.14713.16.camel@localhost.localdomain> (raw)

Hi,
When open/close evdev, the code is as following to handle multi-client
operation:
static int evdev_release(...)
{
	...
	if (!--evdev->open) {
		<------------preempted
		if (evdev->exist)
			input_close_device(...);
		else
			evdev_free(evdev);
	}
	return 0;
}

static int evdev_open(...)
{
	...
	if (!evdev->open++ && evdev->exist){
		errror = input_open_device(...);
		if (error) {
			...
		}
	}
	...
	return 0;
}

So if the evdev_release() is preempted at the point marked by another
process which will open the evdev, which will make operation sequence
like:

   --evdev->open in evdev_release()
         -----> preempted
	                            evdev->open++ and input_open_devie()
	 <----- reschedule 
	input_close_device()

Should we introduce a mutex here? Or do I miss something? Thanks.

Regards
Yin, Fengwei


	




             reply	other threads:[~2007-05-12  3:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-12  3:18 Yin,Fengwei [this message]
2007-05-12  5:05 ` Dmitry Torokhov
2007-05-13 18:12   ` Jens Axboe

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=1178939925.14713.16.camel@localhost.localdomain \
    --to=yfw.kernel@gmail.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome