public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Vojtech Pavlik <vojtech@suse.cz>
Cc: Andrew Morton <akpm@osdl.org>, Greg KH <greg@kroah.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Mark Vojkovich <mvojkovi@XFree86.Org>,
	Michael Schmitz <schmitz@zirkon.biophys.uni-duesseldorf.de>,
	Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>,
	Neil Brown <neilb@suse.de>,
	linux-kernel@vger.kernel.org
Subject: [patch 3/3] Uinput: dont use "interruptible" in FF code
Date: Fri, 18 Nov 2005 23:38:43 -0500	[thread overview]
Message-ID: <20051119044255.131569000.dtor_core@ameritech.net> (raw)
In-Reply-To: 20051119043840.747384000.dtor_core@ameritech.net

[-- Attachment #1: uinput-dont-use-wait-completion-interruptible.patch --]
[-- Type: text/plain, Size: 1475 bytes --]

Input: uinput - don't use "interruptible" in FF code

If thread that submitted FF request gets interrupted somehow it
will release request structure and ioctl handler will work with
freed memory. TO prevent that from happening switch to using
wait_for_completion instead of wait_for_completion_interruptible.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

 drivers/input/misc/uinput.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

Index: work/drivers/input/misc/uinput.c
===================================================================
--- work.orig/drivers/input/misc/uinput.c
+++ work/drivers/input/misc/uinput.c
@@ -92,24 +92,19 @@ static void uinput_request_done(struct u
 {
 	/* Mark slot as available */
 	udev->requests[request->id] = NULL;
-	wake_up_interruptible(&udev->requests_waitq);
+	wake_up(&udev->requests_waitq);
 
 	complete(&request->done);
 }
 
 static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request)
 {
-	int retval;
-
 	/* Tell our userspace app about this new request by queueing an input event */
 	uinput_dev_event(dev, EV_UINPUT, request->code, request->id);
 
 	/* Wait for the request to complete */
-	retval = wait_for_completion_interruptible(&request->done);
-	if (!retval)
-		retval = request->retval;
-
-	return retval;
+	wait_for_completion(&request->done);
+	return request->retval;
 }
 
 static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect)


  parent reply	other threads:[~2005-11-19  4:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-19  4:38 [patch 0/3] Uinput update Dmitry Torokhov
2005-11-19  4:38 ` [patch 1/3] Uinput: convert to dynalloc allocation Dmitry Torokhov
2005-11-19  4:38 ` [patch 2/3] Uinput: add UI_SET_SWBIT ioctl Dmitry Torokhov
2005-11-19  4:38 ` Dmitry Torokhov [this message]
2005-11-19  7:46 ` [patch 0/3] Uinput update Vojtech Pavlik
2005-11-19  9:27 ` Neil Brown

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=20051119044255.131569000.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=akpm@osdl.org \
    --cc=aris@cathedrallabs.org \
    --cc=benh@kernel.crashing.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mvojkovi@XFree86.Org \
    --cc=neilb@suse.de \
    --cc=schmitz@zirkon.biophys.uni-duesseldorf.de \
    --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