public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: emard@softhome.net
To: linux-kernel@vger.kernel.org
Subject: [PATCH] uinput crash maybe this is the FIX
Date: Mon, 17 Oct 2005 00:06:06 +0200	[thread overview]
Message-ID: <20051016220606.GA30260@tink> (raw)
In-Reply-To: <20051016211252.GA21557@tink>

HI

THanks for all the hints.

Here's my fix for the situation in the uinput.
It generally breaks when Force feedback is removed,
sometimes request id slot is not freed correctly and
it can lead to crash and/or running out of slots.

Without knowing much what I'm doing, I added one
lock and it seems to fix the problem.

Please check is this the right approach on how to do
this locks....

--- linux-2.6.13.4/drivers/input/misc/uinput.c.orig	2005-10-15 10:09:38.000000000 +0200
+++ linux-2.6.13.4/drivers/input/misc/uinput.c	2005-10-16 23:54:20.000000000 +0200
@@ -90,10 +90,16 @@ static inline int uinput_request_reserve
 
 static void uinput_request_done(struct uinput_device *udev, struct uinput_request *request)
 {
+	int id;
+	
+	spin_lock(&udev->requests_lock);
+	id = request->id;
+	spin_unlock(&udev->requests_lock);
 	complete(&request->done);
 
 	/* Mark slot as available */
-	udev->requests[request->id] = NULL;
+	if(id >= 0 && id < UINPUT_NUM_REQUESTS)
+		udev->requests[id] = NULL;
 	wake_up_interruptible(&udev->requests_waitq);
 }
 

  reply	other threads:[~2005-10-16 22:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-15 21:29 uinput crash and fix emard
2005-10-15 22:01 ` Mattia Dongili
2005-10-15 22:48   ` Mattia Dongili
2005-10-15 22:51 ` emard
2005-10-16 11:51   ` uinput crash and NO FIX YET emard
2005-10-16 21:12     ` emard
2005-10-16 22:06       ` emard [this message]
2005-10-17  5:55         ` [PATCH] uinput crash maybe this is the FIX Dmitry Torokhov
2005-10-17  7:16           ` emard
2005-10-17 21:28             ` Let this uinput patch go to 2.6.14 emard

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=20051016220606.GA30260@tink \
    --to=emard@softhome.net \
    --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