mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vojtech Pavlik <vojtech@suse.cz>
To: Maciej Babinski <maciej@imsa.edu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: uinput oops in 2.5.41
Date: Wed, 9 Oct 2002 11:42:38 +0200	[thread overview]
Message-ID: <20021009114238.A11161@ucw.cz> (raw)
In-Reply-To: <20021009035041.A6226@imsa.edu>; from maciej@imsa.edu on Wed, Oct 09, 2002 at 03:50:41AM -0500

On Wed, Oct 09, 2002 at 03:50:41AM -0500, Maciej Babinski wrote:
> I get a NULL pointer dereference by running "cat" on /dev/misc/uinput
> I'm a newbie, but I think the patch at the bottom fixes it.

> --- linux-2.5.41/drivers/input/misc/uinput.c	Mon Oct  7 13:24:50 2002
> +++ linux-2.5.41.new/drivers/input/misc/uinput.c	Wed Oct  9 03:47:15 2002
> @@ -224,15 +224,14 @@
>  
>  	udev = (struct uinput_device *)file->private_data;
>  
> +	if (!(udev->state & UIST_CREATED))
> +		return -ENODEV;
> +
>  	if (udev->head == udev->tail) {
>  		add_wait_queue(&udev->waitq, &waitq);
>  		current->state = TASK_INTERRUPTIBLE;
>  
>  		while (udev->head == udev->tail) {
> -			if (!(udev->state & UIST_CREATED)) {
> -				retval = -ENODEV;
> -				break;
> -			}
>  			if (file->f_flags & O_NONBLOCK) {
>  				retval = -EAGAIN;
>  				break;

Your patch is almost correct - you have to keep both the checks. The
first could happen when the device disappears while being waited for.

-- 
Vojtech Pavlik
SuSE Labs

  reply	other threads:[~2002-10-09  9:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-09  8:50 Maciej Babinski
2002-10-09  9:42 ` Vojtech Pavlik [this message]
2002-10-10 21:32   ` Zach Welch

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=20021009114238.A11161@ucw.cz \
    --to=vojtech@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej@imsa.edu \
    /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

all inboxes | Powered by JetHome®